PDA

View Full Version : glDrawPixels v/s glBitmap



hwiman
01-29-2003, 07:34 AM
If drawing 1-bit monochrome image data with glDrawPixels (GL_COLOR_INDEX, GL_BITMAP), is it possible to zoom the image with glPixelZoom? Or does it behave as glBitmap in all aspects? Anyone has other ideas on how to zoom 1-bit data without having to rebuild the image data or resort to texture maps (arbitrary size required)? Sample code?

hwiman
01-29-2003, 07:47 AM
Sorry for bothering - it works just fine to use glDrawPixels and glPixelZoom. Using the Chapter07/bits sample of OpenGL SuperBible, just replace the glBitmap call with:

GLfloat lut[2];
...
glPixelTransferi( GL_MAP_COLOR, GL_TRUE );
lut[0] = 1.0;
lut[1] = 0.0;
glPixelMapfv( GL_PIXEL_MAP_I_TO_R, 2, lut );
glPixelMapfv( GL_PIXEL_MAP_I_TO_G, 2, lut );
glPixelMapfv( GL_PIXEL_MAP_I_TO_B, 2, lut );
glPixelZoom( 2.0, 2.0 );
glDrawPixels( 16, 16, GL_COLOR_INDEX, GL_BITMAP, (GLubyte *) smiley );


Originally posted by hwiman:
If drawing 1-bit monochrome image data with glDrawPixels (GL_COLOR_INDEX, GL_BITMAP), is it possible to zoom the image with glPixelZoom? Or does it behave as glBitmap in all aspects? Anyone has other ideas on how to zoom 1-bit data without having to rebuild the image data or resort to texture maps (arbitrary size required)? Sample code?