PDA

View Full Version : glRasterPos problems



05-11-2001, 09:42 AM
My Problem is that every time i change the raster position when displaying a bitmap
it dissappears it only works when
glRasterPos2f/i(0,0) is as such, or on
glRasterPos2f() when the change is less than
.0001 and that does virtually nothing.
What am i doing wrong?

Deiussum
05-11-2001, 10:46 AM
A couple of things to check.

1. If the raster position is set to something not visible, and you try and use it to draw a bitmap, none of the bitmap will show up.

2. When setting the raster position, it is modified by the current model-view and projection matrices, so if you are doing transforms that will make it go out of your viewing volume, you won't get your bitmap displayed.

One thing you could do would be something like so...

// Set matrix mode
glMatrixMode(GL_PROJECTION);
// push current projection matrix on the matrix stack
glPushMatrix();
// Set an ortho projection based on window size
glLoadIdentity();
glOrtho(0, width, 0, height, 0, 1);

// Switch back to model-view matrix
glMatrixMode(GL_MODELVIEW);

// Store current model-view matrix on the stack
glPushMatrix();

// Clear the model-view matrix
glLoadIdentity();

// You can specify this in window coordinates now
glRasterPosition2f(x,y);

DrawYourBitmap();

// Restore the model-view matrix
glPopMatrix();

// Switch to projection matrix and restore it
glMatrixMode(GL_PROJECTION);
glPopMatrix();

// Switch back to model-view matrix. This isn't
// strictly necessary, but I tend to try and
// keep the model-view matrix as the current
// matrix to keep things simple.
glMatrixMode(GL_MODELVIEW);

05-11-2001, 11:26 AM
Works Perfectly Now, Thanks a lot.