Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

SonicMouse

Loading DIBs from a buffer

This topic is 6489 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

Share this post


Link to post
Share on other sites
Advertisement
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

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites
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


Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!