04-17-2003, 11:48 AM
Hi, All -
I'm using the following piece of code to zoom into a background image that takes up the entire length and width of my screen:
//-------------------------------
... after grabbing hDC and hRC...
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glTranslatef( 0.0, 0.0, 1.0 );
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
setViewport();
clearBuffers();
... inside the drawBackground() function...
glPixelStorei( GL_UNPACK_ROW_LENGTH, 0 );
glPixelStorei( GL_UNPACK_SKIP_PIXELS, 0 );
glPixelStorei( GL_UNPACK_SKIP_ROWS, 0 );
glPixelZoom( imageXScale, imageYScale );
glRasterPos3i ( x, y, 0 );
glDrawPixels( imageW, imageH, GL_RGBA, GL_UNSIGNED_BYTE, image.GetData() );
... returned from drawing background...
glFlush();
SwapBuffers( hDC );
... release hDC and hRC
//-------------------------------
imageXScale and imageYScale increment by small amounts each time through the function.
Everything works as expected for the first three times I scale the image. On the fourth scale, the screen goes black.
Recall that the background image initially fills the screen and that I want to zoom into that full-screen image... if I start with an image that's less than screen size it will zoom until it fits the window dimensions... then four more times, then black.
http://www.opengl.org/discussion_boards/ubb/confused.gif
Any ideas?
Thanks!
I'm using the following piece of code to zoom into a background image that takes up the entire length and width of my screen:
//-------------------------------
... after grabbing hDC and hRC...
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glTranslatef( 0.0, 0.0, 1.0 );
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
setViewport();
clearBuffers();
... inside the drawBackground() function...
glPixelStorei( GL_UNPACK_ROW_LENGTH, 0 );
glPixelStorei( GL_UNPACK_SKIP_PIXELS, 0 );
glPixelStorei( GL_UNPACK_SKIP_ROWS, 0 );
glPixelZoom( imageXScale, imageYScale );
glRasterPos3i ( x, y, 0 );
glDrawPixels( imageW, imageH, GL_RGBA, GL_UNSIGNED_BYTE, image.GetData() );
... returned from drawing background...
glFlush();
SwapBuffers( hDC );
... release hDC and hRC
//-------------------------------
imageXScale and imageYScale increment by small amounts each time through the function.
Everything works as expected for the first three times I scale the image. On the fourth scale, the screen goes black.
Recall that the background image initially fills the screen and that I want to zoom into that full-screen image... if I start with an image that's less than screen size it will zoom until it fits the window dimensions... then four more times, then black.
http://www.opengl.org/discussion_boards/ubb/confused.gif
Any ideas?
Thanks!