Archived

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

TheLabRat

3D to Screen Coords (GL)

Recommended Posts

TheLabRat    122
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
MButchers    123
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