Loading bmp as resources in Visual C++ 6
I have been writing OpenGL programs for a while. But I have never been very faimiliar with Visual C++. I used to use TC++ and QBASIC. Anyway, I have used the tutorials on this site a lot and I still use the methods they promote here. I load my texture with the following function:
AUX_RGBImageRec *LoadBMP(char *Filename) //Loads A Bitmap Image
{
FILE *File=NULL; // File Handle
if (!Filename) // Make Sure A Filename Was Given
{
return NULL; // If Not Return NULL
}
File=fopen(Filename,"r"); // Check To See If The File Exists
if (File) // Does The File Exist?
{
fclose(File); // Close The Handle
return auxDIBImageLoad(Filename); // Load The Bitmap And Return A Pointer
}
return NULL; // If Load Failed Return NULL
}
Is there an easy way to load the texture from a Visual C++ resource instead? I have already made a .bmp as a resource but I don''t know what kind of source I need to load it.
- See OpenGL at www.stevescomp.atfreeweb.com
- I program. Do you? www.gldomain.com
I had some trouble with this myself. I wanted to put all my textures as resources and use them, but I think OpenGL will think it''s an incompatible type. I did something like
...
if(TextureImage[0]=MAKEINTRESOURCE(picture)){
...
It compiled an all, but is crashed when I ran the program, I believe that you need to have a pointer to a texture. I just thought about that, maybe auxDIBImageLoad(MAKEINTRESOURCE(picture)) may work. I''ll try this when I''m home from school. Be sure to include "resource.h" in the main .c/.cpp file before compiling.
--
Big-Felt
...
if(TextureImage[0]=MAKEINTRESOURCE(picture)){
...
It compiled an all, but is crashed when I ran the program, I believe that you need to have a pointer to a texture. I just thought about that, maybe auxDIBImageLoad(MAKEINTRESOURCE(picture)) may work. I''ll try this when I''m home from school. Be sure to include "resource.h" in the main .c/.cpp file before compiling.
--
Big-Felt
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement