Jump to content
  • Advertisement
Sign in to follow this  
lood339

raster postion problem

This topic is 3743 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 just want to change de raster position using following codes glGetFloatv(GL_CURRENT_RASTER_POSITION, raster_pos1);// the raster pos1 glRasterPos2i(200, 200);//change the raster pos glGetFloatv(GL_CURRENT_RASTER_POSITION, raster_pos1);// get the new raster pos2 the result is like that: pos1:0.0, 0.0, 0.0, 1.0; pos2:0.0, 0.0, 0.0, 1.732 how strange! the following is my perspective and lookat.I guess there may be some relation between them. glViewport(0,0,(GLsizei)w, (GLsizei)h); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(60, (GLsizei)w/(GLsizei)h ,0.01, 200.0); glMatrixMode(GL_MODELVIEW); gluLookAt(0.0, 0.0, 1.732, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); It will be very nice of you to give me some using information about raster postion and some thing about my code. thanks

Share this post


Link to post
Share on other sites
Advertisement
If you set the raster position using glRasterPos, the coordinate you pass will be transformed by the modelview and the projection matrix into clip space, then clipped and perspective divided, and then transformed into window coordinates. However, if it fails the clip stage, it will be marked as invalid and all rendering commands using the raster position will be ignored. In short, the raster position is treated as a vertex.

From the values, it looks like you want to specify the raster position in window coordinates directly. You can do that either by setting the proper modelview and projection matrices to get a direct mapping from object to screen space, or specify it directly using glWindowPos instead. The good thing with glWindowPos is that it is always valid even outside the window, something you must "hack" to get using glRastrePos.

Share this post


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

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!