How to Zoom in and Zoom Out using JOGL?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

How to Zoom in and Zoom Out using JOGL?

Manjunatha Bhat
How to Zoom in and Zoom Out the panel or frame using the mouse wheeler ,is there any specific API are there to Zoom functionality? How to Achieve that?
Reply | Threaded
Open this post in threaded view
|

Re: How to Zoom in and Zoom Out using JOGL?

gouessej
Administrator
Hey

You have to use a mouse wheel listener in order to update your model view matrix.
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: How to Zoom in and Zoom Out using JOGL?

Manjunatha Bhat
can you give little bit more information about this?
Reply | Threaded
Open this post in threaded view
|

Re: How to Zoom in and Zoom Out using JOGL?

jmaasing
You should read relevant tutorials, they are easy to find using a search engine like google.

https://docs.oracle.com/javase/tutorial/uiswing/events/mousewheellistener.html

OpenGL is a low level graphics API which requires you to do many calculations in your own code, there is no "zoom API". If you want to have higher level APIs you could look at, for example: JogAmps Ardour3D continuation, or jMonkeyEngine.
Reply | Threaded
Open this post in threaded view
|

Re: How to Zoom in and Zoom Out using JOGL?

Manjunatha Bhat
In reply to this post by gouessej
hi sir,
In my application .. mouseWheellistener  and mousemotionlistener  attached to a GLCanvas. GLCanvas is attached to the frame . if attached mouse listener i'm getting the error andfor that  i need to extends to AWT.  All the mouse events of  mouseWheellistener  and mousemotionlistener appear  to working fine ..but i'm not able to understand model view metrics and projection metrics properly .in my application i can able to render the 2D shape like Circle . i'm trying to implement the zoom operation using mouse event ...
please give some idea for transformation and Zooming operation in JOGL . I'm doing homework for this .but i din't get the solution .is there any documents related this.



Thank you.
Reply | Threaded
Open this post in threaded view
|

Re: How to Zoom in and Zoom Out using JOGL?

gouessej
Administrator
Why do you mean by "i need to extends to AWT"? You just need to implement the interface MouseWheelListener and to add it into your GLCanvas by calling this method.

A simple solution consists in modifying the field of view in your projection matrix, look at glFrustum or gluPerpective if you use the perspective projection or glOrtho if you use the parallel projection.
Julien Gouesse | Personal blog | Website