Jump to content
  • Advertisement


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


gluProject(); How do you do it ?

This topic is 6156 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 tryed this about 2 times and it doesn`t work...although someone told how to do it... Here it is : What`s wrong and what should I put in ? double transformed[3], realpoint[3]; float projmat[16];glGetFloatv(GL_PROJECTION_MATRIX,projmat); float modmat[16];glGetFloatv(GL_PROJECTION_MATRIX,modmat); double viewport[2]={width,height}; gluProject(realpoint[0], realpoint[1], realpoint[2], modmat, projmat, viewport, &transformed[0], &transformed[1], &transformed[2]);

Share this post

Link to post
Share on other sites
viewport needs to contain 4 values: top, bottom, left & right.
You need to add {0, 0} to your viewport array.
I''m not sure about the order though, can''t find my book at the moment...


Share this post

Link to post
Share on other sites
The final version of that...(It works but it seems that the y is more than 0 ) :
typedef struct{
float x,y,z;
void GetPoint(CVector3 Pos,int *x,int *y)
{//Still I need ints as returned values
double t[3],r[3]={Pos.x,Pos.y,Pos.z};
double projmat[16];glGetDoublev(GL_PROJECTION_MATRIX,projmat);
double modmat[16];glGetDoublev(GL_MODELVIEW_MATRIX,modmat);
int viewport[4]={0,0,int(width),int(height)};
int xx=int(t[0]),yy=int(t[1]);

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!