Raster graphics in OpenGL

Started by
6 comments, last by smitty1276 22 years, 11 months ago
I''m having a hard time figuring this out! I''ve seen a lot of examples for glDrawPixels() and glBitmap(), but they all seem to be written using a single buffered window. Is there any thing in particular I need to do differently in a double-buffered window? The program will run, but the pixels are never drawn. Just an empty window.
Advertisement
Why don''t you just use the classic glVertex__ (in this case probably 2i), after using glOrtho and glViewport to set up a (0,0)=Top-Left Window in Orthographic mode?

Resist Windows XP''s Invasive Production Activation Technology!
http://druidgames.cjb.net/
Well, I''m wanting to be able to do the raster graphics on top of the 3d stuff... Fonts, HUDs, etc. How do I go from rendering polygons to drawing in 2D onto the screen?
Well, I''m wanting to be able to do the raster graphics on top of the 3d stuff... Fonts, HUDs, etc. How do I go from rendering polygons to drawing in 2D onto the screen?
Do a glPushMatrix, then do this:
    glViewport(0,0,width,height);  glMatrixMode(GL_PROJECTION);  glLoadIdentity();  glOrtho(0.0f,width,height,0.0f,near,far);  glMatrixMode(GL_MODELVIEW);  glLoadIdentity();  

Then when you''re done drawing 2D stuff, do a glPopMatrix.

Resist Windows XP''s Invasive Production Activation Technology!
http://druidgames.cjb.net/
glDrawBuffer(..), glDrawBuffer(..) u can set these to the front/back buffers with GL_FRONT/GL_BACK. standard for a single buffer is both GL_FRONT + double buffered window GL_BACK.
note with glDrawPixels() + glBitmap() it draws from the current raster position use glRasterPos..(..) to change this.

but all this is prolly of little use cause for a HUD textured quads are normally the way to go.

http://members.xoom.com/myBollux
Thanks for the info guys! Pushing the matrix and the ortho mode stuff wasn''t discussed AT ALL in the book I''m learning from.

So you think textured quads would work best for, as an example, the instrument panel in an airplane? I always thought the way to go would be to draw the panel itself onto the screen and use sprite type images for the individual dials and needles and stuff.

Thanks for the info...
raster is really really slow. using textured quads would be many times faster. the only reason to use raster graphics is if the target computer doesn''t have hardware accel(like school comps). then in that case, raster is slightly faster.

life is unfair, take advantage of it.
UNMB2 - if the link doesn''t work, try clicking it
life is unfair, take advantage of it.UNMB2 - if the link doesn't work, try clicking it :)

This topic is closed to new replies.

Advertisement