Ehsan Kamrani
04-11-2006, 01:59 PM
I have seen this pitfall in the book OpenGL: A PRIMER. If it's not in common 16 pitfalls, it's not bad to add this condition to the pitfalls;-) Here's the pitfall:
The present raster color is locked by the use of glRasterPos*(). Thus, in the following code, the bitmap is drawn in red because the raster color is the color that was in effect the last time the function glRasterPos2i() was executed:
glColor3f( 1.0f, 0.0f, 0.0f );
glRasterPos2i( x, y );
glColor3f( 0.0f, 1.0f, 0.0f );
glBitmap(...);
Reference : OpenGL A PRIMER, page 139
-Ehsan-
The present raster color is locked by the use of glRasterPos*(). Thus, in the following code, the bitmap is drawn in red because the raster color is the color that was in effect the last time the function glRasterPos2i() was executed:
glColor3f( 1.0f, 0.0f, 0.0f );
glRasterPos2i( x, y );
glColor3f( 0.0f, 1.0f, 0.0f );
glBitmap(...);
Reference : OpenGL A PRIMER, page 139
-Ehsan-