|
From: Mark D. <mar...@zn...> - 2007-03-20 01:13:28
|
Hi,
My knowledge of OpenGL is very limited so the help I can offer is very
sketchy.
I think the solution to zooming is using glPushMatrix() and glTranslatef().
So in the wxGLCanvas.pm demo module, if you look at
Wx::DemoModules::wxGLCanvas::Cube->Render()
you'll see the statement
glTranslatef( 0, 0, -5 );
If you change this to glTranslatef( 0, 0, -20 );
you get a different zoom factor.
So I guess you would need to change it to something like
glTranslatef( 0, 0, $self->GetZoomFactor() );
add a couple of subs to the module:
sub GetZoomFactor {
my $self = shift;
return $self->{zoomfactor} || -5;
}
sub SetZoomFactor {
my $self = shift;
$self->{zoomfactor} = shift;
}
then add some interface element to call SetZoomFactor in response to
user request.
I think the first two params to glTranslatef() hold the answer to
panning left / right - but I'm not sure.
That's the limit of my OpenGL knowledge I'm afraid.
Regards
Mark
Vaughn Staples wrote:
> Mark,
>
> Your examples have been immensely helpful ... thank you very much.
>
> Could I also ask for guidance on the methods necessary to zoom in/out?
> I have had no difficulty modifying the code to spin the cube in the
> X/Y/Z axis, but changing the zoom perspective is beyond my grasp. I'm
> also seeking counsel on panning left-to-right, but I believe once I
> solve the zoom issue that panning should not be difficult to solve on my
> end.
>
> Best regards,
>
> Vaughn
>
> ----- Original Message -----
> From: "Mark Dootson" <mar...@zn...>
> To: "Vaughn Staples" <vau...@in...>
> Cc: <wxp...@li...>
> Sent: Monday, March 19, 2007 5:05 PM
> Subject: Re: [wxperl-users] WxPerl & OpenGL Question
>
>
> Hi,
>
> You need to install the wxDemo modules
>
> cpan Wx::Demo.
>
> This may give you all the info you needed.
>
> If not, I have a couple of rough examples for you.
>
> http://www.wxperl.co.uk/example1.txt
>
> does exactly what you described - diplays two controls side by side.
>
> I though that you probably wanted to have a split window so you could
> resize your filelist vs the GLCanvas so I did
>
> http://www.wxperl.co.uk/example2.txt
>
> to include Wx::SplitterWindow.
>
> Both these examples use the wxGLCanvas.pm from the Wx::Demo so that
> needs to be installed.
>
> Best Regards
>
> Mark
>
>
> Vaughn Staples wrote:
>> I am trying to construct a wxPerl frame containing a menubar at the
>> top
>> followed by twin widgets below that are tiled side-by-side. The one
>> to
>> the left is a listCtrl containing a list of image files, and most
>> importantly the one to the right is a glCanvas that will be used to
>> draw
>> primitives and/or display images.
>>
>> I have studied the glCanvas "minimal.pl" distributed by Mattia but
>> cannot seem to retrofit it to solve the above purpose.
>>
>> Can anyone share guidance and/or provide a simple wxPerl example of
>> how
>> to embed an openGL-related canvas in a wxPerl frame which contains
>> other
>> items?
>>
>> Many thanks in advance,
>>
>> Vaughn
>
|