Skip to main content
GameDev.net gamedev.net
🔒 Locked

Open GL selection Question...

Started by Peter Svensson Apr 15, 2000 at 1:47 PM 0 replies 550+ views
Original Post
Peter Svensson
Peter Svensson
Hi everybody! I''m trying to make a 3D modelling program in Open GL. And my problem is that i can''t select vetices on the screen using the mouse. What i want to do is, convert the mouse coordinates to a vertex so i can compare that vertex with all vertices in the 3d object. And if it is a close match to any vertex in the 3d object then that vertex will be selected. You know what i meen... This is the code im working with... It seems to work when I scale my 3d object but it does not work when i have rotated my object. Why? glGetDoublev( GL_PROJECTION_MATRIX, projectionMatrix ); glGetDoublev( GL_MODELVIEW_MATRIX, modelviewMatrix ); glGetIntegerv( GL_VIEWPORT, viewport ); gluProject( x, y, z, modelviewMatrix, projectionMatrix, viewport, &winX, &winY, &winZ ); gluUnProject( mouseX, mouseY, winZ, modelviewMatrix, projectionMatrix, viewport, &x, &y, &z ); // Thanx, Peter....

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.