PDA

View Full Version : getting vertex data



dawny
07-14-2004, 06:49 AM
as i didnt get the help i needed in the beginners forum i try here again :)
and just for that start i CANT use glut functions so i cant use something like GLUunproject() to solve my problem..

ok here we go hehe:

------------

hi guys i need your help

i got a simple problem...
i got a 3d model displayed...
now want i want is, clicking on the model with the mouse and getting the coordinates of the nearest vertex to the mouse pointer.

in other words i need a selection-vertex function which is included in every 3d modelling pogramm.

i know i have to caculate from 2d mouse coords to 3d model coords.. but i dont know how?!?!

have you got any tutorials on this ??
or can you write me the basics?

p.s. i cannot use any glut functions only opengl!
glut is not allowed in my c++ code (dont ask why :) )

Kilam Malik
07-14-2004, 09:26 AM
So you have to do the same as the gluunproject function does. It is simple matrix multiplication. Just have a look at the input parameters of the gluunproject. It's two matrices and the viewport. Shouldn't be to hard to figure out the reverse matrix.
An easier way would be to download the MESA source code, which is a software implementation of OpenGL. You'll sure find the gluunproject source code there.

Kilam.

yooyo
07-14-2004, 10:18 AM
Maybe you can project all vertices in software and find closest one to mouse?

yooyo

knackered
07-14-2004, 10:25 AM
Yeah, yeah, yeah - do that, do it, go on. Genius.

yooyo
07-14-2004, 06:06 PM
WWWY?
Im pretty sure he will try to do quad or area selection?

OK.. there is a another solution... make a "ray" viewer -> mouse and for each vertex calc distance from "ray". Keep closest vertex...

yooyo

Kilam Malik
07-15-2004, 04:05 AM
Ehm... another thing -> GLUT != GLU. You can of course use gluunproject without using GLUT.

Kilam.

Ysaneya
07-15-2004, 06:39 AM
That's what i was going to say. gluUnproject is in GLU, not in GLUT, so why couldn't you use it ?

Y.

dawny
07-16-2004, 08:12 AM
sorry my fault glu isnt glut i know now :)

thx for your help guys i try to use gluunproject or at least look at its code

SeskaPeel
07-19-2004, 04:25 AM
Maybe you should wonder what links will give google if you type "mouse selection opengl".

I guess you will find what you need ... if not, have a closer look . And if still not, go on opengl.org (second result in google) for such basic topics.

SeskaPeel.