Using glBitmap() and glDrawPixels()

I am trying to display various different formats with glDrawPixels(), like BMP(1bit,gray4bit,gray8bit,indexColor8bit,rgb24).
Also trying to use glBitmap().

Can someone please help me!


Can someone PLEASE help out a guy in need…i’m desperate!!!

ive seen you post before but i cant understand what youre having problems with its very simple. perhaps something else is the problem?

glDrawPixels( image_width, image_height, format, type, pixels )

( im talking about the standard formats here )
format + type can be various things eg

format ->
GL_RGB for a 24 bit image
GL_RGBA for a 32 bit colour image
GL_LUMINANCE for a grey scale image

type ->
GL_UNSIGNED_BYTE you supply the data as unsigned chars ie 0-255
GL_FLOAT you supply the data as floats ie 0.0 - 1.0

Perhaps I forget to mention that I’m
a beginner with C & openGL also.
That is why I am having problem with a simple BMP loading.

For example I would like to load Black & White BMP (1 bit) image with glDrawPixel function.
I would like to process pixels on the image but I did not find out a simple example how to do that.

To keep in mind, I am a C/GL starter but I’m trying.

If you have some source example for this simple thing, I would be grateful to you!


OpenGL had no file loading functions. Do a search for code that can be used to load a BMP file. There are numerous examples, and it just takes a bit of searching.

Check this out, this page has everything for us newbies.

for displaying 1bit image data (loaded for e.g. from BMP) u could use glBitmap(), but rather I’d use that for masking.
For displaying you should use glDrawPixels
, where u set the dimensions of the “image”
you want to draw, pixel format… and pointer
to pixel data… for e.g. pixel data could be{RR1,GG1,BB1,RR2,GG2,BB2…}

For drawing only pixel u could use glDrawPixel(1,1,format,type,data) ? but that seems lame.

I am only a beginner, so if there are mistakes in my post, please correct them.


Thanks again!
Next time I will post a link to simple sample I have created.