PDA

View Full Version : getting vertices coordinates



07-13-2004, 08:06 PM
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 :) )

mikael_aronsson
07-13-2004, 11:21 PM
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 ?

Mikael

07-14-2004, 05:43 AM
hi again

as i said i CANT use glut functions

GLUunproject is glut :)

07-14-2004, 07:34 AM
Originally posted by <dawnbuffy>:
GLUunproject is glut :) Nope, its part of GLU but not GLUT, the T makes quiet a difference.

CrazyButcher
07-14-2004, 07:34 AM
glu is not glut
so if you say you cant use glut
gluunproject is still valid being part of glu

07-14-2004, 07:57 AM
ahh sorry i didnt no that :)

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?

07-14-2004, 07:58 AM
didnt know that i mean.. hrhr