View Full Version : loading textures out of a ressource not a file

Harry of DAIW
07-27-2000, 12:17 PM
i have this code and it works:

AUX_RGBImageRec *TextureImage[1];
TextureImage[0] = auxDIBImageLoad("DATA/HARRY4.BMP");
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, 256, 256, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[0]->data);

but now i want to read the bitmap from my resource, with is linked to the exe.
i made:
void * was = &asdasd;
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, 256, 256, GL_RGB, GL_UNSIGNED_BYTE, was);

but now my texture looks totally silli, like memory trash.
Does one of you know why, and how to solve this problem?
thanks in advance

07-27-2000, 12:48 PM
From the looks of it auxDIBImageLoad(pic) loads the file and processes the file's header and returns a pointer to the bitmap pixel data. LoadBitmap simply loads a bitmap resource, it does not process the header of that bitmap. You need to process the bitmap header to get a pointer to the bitmap's pixel data. And load that into OpenGL, not the handle to the bitmap.

[This message has been edited by DFrey (edited 07-27-2000).]

07-28-2000, 08:57 AM
I have written a program that converts 24bits bitmap images into a text file containing an array of values that you can cut and paste into your source code. It has the same effect as using a ressource but it works and it's much faster to let the program convert the bitmap than doing it by hand (which would take you some years for a 256x256 image).
contact me moz@ifrance.com if you are interested.

Harry of DAIW
07-28-2000, 08:59 AM
thank you very much, but now i already coded a sollution ... http://www.opengl.org/discussion_boards/ubb/smile.gif ...