• Advertisement
Sign in to follow this  

Getting rendered vertex coordinates

This topic is 4348 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

I am looking for a way to find out the coordinates on the window of a rendered vertex. I tried some stuff with gluProject, but ran into a dead end there, and looked through a list of glGet parameters but couldn't find anything that looked helpful. Thanks for any help.

Share this post


Link to post
Share on other sites
Advertisement
gluProject() should work, given the correct parameters. What sort of problems did you run into?

Share this post


Link to post
Share on other sites
In the setup I'm using, gluProject is defined as
public static extern int gluProject( double objx, double objy, double objz, double modelMatrix, double projMatrix, int viewport, ref double winx, ref double winy, ref double winz );

Everything I read says that modelMatrix, projMatrix, and viewport should all be arrays.

My code looks like

double[] projMat = new double[16];
double[] modelMat = new double[16];
int[] viewport = new int[4];
GL.glGetDoublev(GL.GL_PROJECTION_MATRIX, projMat);
GL.glGetDoublev(GL.GL_MODELVIEW_MATRIX, modelMat);
GL.glGetIntegerv( GL.GL_VIEWPORT, viewport );

double winX=0, winY=0, winZ=0;
GLU.gluProject(0,0,0,modelMat,projMat,viewport,ref winX, ref winY, ref winZ);


As you can see, it's using arrays for those three arguments, so it won't compile.

I'm using c#.

Share this post


Link to post
Share on other sites
I don't know c#, so I can't tell you why it won't compile. I'm sure somebody else can though. In any case, you should give gluProject() a chance before pursuing other solutions; it really should work.

Share this post


Link to post
Share on other sites
I just changed that "bridge" file to want arrays instead, and everything worked. Thanks!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement