PDA

View Full Version : Using glBitmap() and glDrawPixels()



alesp
04-05-2001, 03:49 AM
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!

AlesP

alesp
04-05-2001, 11:11 PM
Can someone PLEASE help out a guy in need...i'm desperate!!!!

zed
04-06-2001, 12:34 AM
ive seen you post before but i cant understand what youre having problems with its very simple. perhaps something else is the problem?

glRasterPos2i(0,0);
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

alesp
04-08-2001, 01:04 AM
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!

Thanks?

Deiussum
04-08-2001, 06:17 AM
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.

Epicenter
04-08-2001, 09:21 AM
Check this out, this page has everything for us newbies.
http://nehe.gamedev.net/opengl.asp

Feldi
04-09-2001, 01:16 AM
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.

alesp
04-09-2001, 10:48 PM
Thanks!

alesp
04-14-2001, 08:15 PM
Thanks again!
Next time I will post a link to simple sample I have created.