Resources in Win32
I''ve been programming window apps in Win32 and MFC for a few years now. I''m used to include all of my icons, menu''s, bitmaps,... in the resource section of the .exe file.
I want to put my textures in the resource section as bitmaps. Is this possible? For my screensaver project I don''t use many texures, so it would be opportune to include them in the .exe file (the .scr file in fact);
Can anyone help me with this?
Thanks!
Sorry for my crappy English
Dreamers live longer
Dreamers live longer
Bitmaps are standard supported so that should be no problem.
But you might want to consided another file format. You can import any file of any type into the resources.
I personally like uncompressed 24bit TGA''s very much. This file format is very easy. If you need help with these - you know where to find me,
- Bas.
But you might want to consided another file format. You can import any file of any type into the resources.
I personally like uncompressed 24bit TGA''s very much. This file format is very easy. If you need help with these - you know where to find me,
- Bas.
I would like to know how to do this also. Ive been working with resources in alot of my delphi apps, but dont know what to do with the resource handle (after the LoadResource() command) in opengl to load the textures, i dont want to be using the components that come with delphi because im not using the actual GUI.
Any source code? c or c++ source is fine, i can translate.
Any source code? c or c++ source is fine, i can translate.
Here''s something simple I cooked up to load in grayscale RAW textures.
Thom Wetzel
www.LMNOpc.com
void LoadRawTexture(char* strName, const int TexNumber, const int width, const int height){ HRSRC hResInfo = NULL; HGLOBAL hResData = NULL; VOID* pvRes = NULL; GLbyte* pbRes = NULL; if (NULL == (hResInfo = FindResource(NULL, strName, TEXT("RAW")))) return; if (NULL == (hResData = LoadResource(NULL, hResInfo))) return; if (NULL == (pvRes = LockResource(hResData))) return; pbRes = (GLbyte*)pvRes; glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glBindTexture(GL_TEXTURE_2D, TexNumber); gluBuild2DMipmaps(GL_TEXTURE_2D, 1, width, height, GL_LUMINANCE, GL_UNSIGNED_BYTE, pbRes); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);}
Thom Wetzel
www.LMNOpc.com
ThomWwww.LMNOpc.com
Legend? *blush* Hardly.
Just glad I can help someone else instead of begging for help here in the forums like I normally do.
ThomW
www.LMNOpc.com
Just glad I can help someone else instead of begging for help here in the forums like I normally do.
ThomW
www.LMNOpc.com
ThomWwww.LMNOpc.com
hehe.. i just decided to go implement this into my project, only to realise that i needed to extract some information (the header) from the .tga file to determine if it had an alpha value or not.
Would you happen to know how to obtain the actual binary data from the tga file once it has been added to your application''s resource list?
Thanks in advance, i should''ve checked it out earlier.
- Wav
Would you happen to know how to obtain the actual binary data from the tga file once it has been added to your application''s resource list?
Thanks in advance, i should''ve checked it out earlier.
- Wav
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement