PDA

View Full Version : how can i display a pixmap to the screen using glDrawPixels



10-27-2006, 07:29 PM
Hi, i'm kind of new to opengl. I'm wonder if any can help me on this problem.

first i used the function:
Texture = auxDIBImageLoad(pFilename);

to load an "name.bmp" picture to Texture
then i try to use the Texture data to display directly to the screen with this function:

glRasterPos2i (50,50); // starting point to draw the data
glDrawPixels (Texture->sizeX, Texture->sizeY, GL_RGB, GL_UNSIGNED_BYTE, Texture->data);

The result output did display the picture i created in paint. Can anyone help please

songho
10-27-2006, 08:16 PM
I am not sure what your problem is.

I have my own BMP loader/writer and a testing code to view a BMP using glDrawPixels(). First, take a look at the source code how I did.
imageBmp.zip (http://songho.ca/opengl/files/imageBmp.zip)

If you still have troubles, please post the problem once again.

10-27-2006, 09:41 PM
Thank you so much, it is all clear now thank :)
May i ask u a question?
Where do u get all the information of the bmp structure at? is there a possible place i can locate most of the structure of different picture format? Like jpg,png, etc. :)

10-28-2006, 12:22 AM
www.wotsit.org (http://www.wotsit.org) has information about many common file formats.

Please learn to use your favorite search engine for common queries like this one. Typing "file formats" into google, for example, lists wotsit first. Persistence and creative search queries can prove fruitful, and can produce information widely and not so widely known to the less illuminated among us.