getting vertex data

as i didnt get the help i needed in the beginners forum i try here again :slight_smile:
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 :slight_smile: )

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.

Maybe you can project all vertices in software and find closest one to mouse?

yooyo

Yeah, yeah, yeah - do that, do it, go on. Genius.

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

Ehm… another thing -> GLUT != GLU. You can of course use gluunproject without using GLUT.

Kilam.

That’s what i was going to say. gluUnproject is in GLU, not in GLUT, so why couldn’t you use it ?

Y.

sorry my fault glu isnt glut i know now :slight_smile:

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

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.