Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

TheLabRat

3D to Screen Coords (GL)

This topic is 6323 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Sorry I''m asking this again (I did a week or two back) My internet connection is giving hell and I can''t even browse that far into gamedev. How do I find the screen pos of a vertex in GL? I realise involves getting the matrices out but which ones and how do I multiply the vertex in? I''m trying to get a lense flare on the sun in my game Thanks

Share this post


Link to post
Share on other sites
Advertisement
Hi there,

use gluProject in conjunction with glGet

ie

  

//get latest transformation,viewport and model matrices used in clip vertex

glGetIntegerv(GL_VIEWPORT,@m_Viewport);
glGetDoublev(GL_PROJECTION_MATRIX,@m_Projection);
//get current model view matrix

glGetDoublev(GL_MODELVIEW_MATRIX,@m_Model);
//use glu project so that we ? use hardware transformations where present

gluProject(Vertex.Position[0],Vertex.Position[1],Vertex.Position[2],@m_Model,@m_Projection,@m_Viewport,win_x,win_y,win_z);



Hope this helps.

PS this is delphi code pointers will need adjusting for c++.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!