Advertisement

Loading DIBs from a buffer

Started by January 13, 2001 03:09 PM
3 comments, last by SonicMouse 23 years, 10 months ago
I am sortof new to OpenGL, and i was wondering if anyone knew how to load a Device independant bitmap using a buffer, instead of using the auxDIBImageLoad which requires a filename as the parameter... isnt there something like this? auxDIBImageLoadBuffer(BYTE* pBuffer, int buffsize) thanks!
Hi

it's easy...you don't need anything for it
auxDIBImageLoad is there to make you a buffer out of a bitmap, so if you already have your texture data in a general pixel buffer you don't need any helper function

the only thing you need are your buffer(the raw pixel data), it's height and with

you simply call

glTexImage2D(GL_TEXTURE_2D, 0, 3, width, height, GL_RGB, GL_UNSIGNED_BYTE, buffer )


Hope that helps
Burning_Ice




Edited by - Burning_Ice on January 13, 2001 4:48:56 PM
Advertisement
Excellent!

Now do you know what exacly the auxDIBImageLoad does to a bitmap?
does it strip the headers off the bitmap and just have the actual bitmap bits?
basically what im asking is: when you use the auxDIBImageLoad, what is left of the acutal bitmap in the buffer it returns?
I am going to do some studying on this from my compiler, but any info you could give would be excellent.

thanks so much for your help!
Glad to help

as far as i know auxDIBImageLoad reads in the bitmap from the file, gets size and format information from the header and stores the actual pixel color data in the array
but i guess it does some work to the buffer first, as bmps are in BGR format, so it converts it to RGB and turns it 180 degree if the input is a bottom-up bmp

and if the bmp is not 16 or 32bit it will propably decode it into 24bit so it can write 3 bytes for R, G and B in the output buffer


geez!
well, i think what ill do is save them to disk before importing =)
i only have to do it once in the initialization so its no biggie.
well, now i know.. thanks alot man!

This topic is closed to new replies.

Advertisement