Skip to main content
GameDev.net gamedev.net
🔒 Locked

raster postion problem

Started by lood339 Jul 19, 2008 at 9:27 AM 0 replies 1k views
Original Post
lood339
lood339
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
Brother Bob
Brother Bob
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.