getting vertices coordinates

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: )

Hi !

gluUnProject() can do the 2D to 3D conversion for you but it may not be of much help because you don’t know the Z value.

Why can’t you just use selection mode to find the hits ?


hi again

as i said i CANT use glut functions

GLUunproject is glut :slight_smile:

glu is not glut
so if you say you cant use glut
gluunproject is still valid being part of glu

Originally posted by <dawnbuffy>:
GLUunproject is glut :slight_smile:
Nope, its part of GLU but not GLUT, the T makes quiet a difference.

ahh sorry i didnt no that :slight_smile:

thx guys

lets say i cant use any glu or glut functions
how do i get from 2d screen coords to 3d vertex coords then?

didnt know that i mean… hrhr