PDA

View Full Version : Center on point



MBonevil
11-01-2004, 06:25 AM
Hi,

I have an OpenGL view, and I want to center the view
on point where the user click.

Example :

If I click on Point(50,50) -> I want to center on point(50,50).

Someone can help me ?

mikael_aronsson
11-02-2004, 06:18 AM
Hi !

It's not that simple, if you are using 2D only it's no big geal, but in 3D, what are you clicking on ? the X,Y coordinates for the point depends on the depth.

So normally you need "something" to click on so you can get a depth value (have a look at gluProject and gluUnProject).

Mikael

MBonevil
11-02-2004, 07:01 AM
I have an object for clicking on it.

I use both 2D and 3D.

I use "gluUnProject" for obtain my position when
I click.

But if I set the Pan with the position, it don't
center correctly my object.