glDrawPixels only works some times?
Posted on 2006-04-11
I load a bitmap into an unsigned char buffer, then (after reversing the BGR to RGB bytes) send it to glDrawPixels in the classic call:
glPixelStorei (GL_UNPACK_ALIGNMENT, 4);
glRasterPos2f (atX, atY);
glDrawPixels (width, height, GL_RGB, GL_UNSIGNED_BYTE, bitmapImage);
[atX] and [atY] get changed around as I move the image on the screen (Yes: we're bordering on Game Programming here. Since this is based on OpenGL mechanics - glDrawPixels - I figured it belonged here...), and sometimes (with the wierdest of locations) the image displays/shows up. In the wrong place than I intended, but it appears! (Sometimes...)
For instance, when I tell it to display atX = -11.0 atY = -0.7 --- this seems to put the image on the screen, sort of. Long story short: why would this work sporadically? Or would you like to see the code that calls this? I can include it, if you like, but it's sort of involved...
I just don't get the sporadic works/don't work nature of the call... ...could I be doing something insignificant elsewhere that is causing OpenGL to freak out?
Hoping for some light to shed on my poor, benighted program,
- The Lurking LongFist