#### Archived

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

# Resources in Win32

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

## Recommended Posts

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

##### Share on other sites
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.

##### Share on other sites
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.

##### Share on other sites
Here''s something simple I cooked up to load in grayscale RAW textures.

  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

##### Share on other sites
lol, that easy. Cheers, you''re a legend ThomW

Thanks a lot!

##### Share on other sites
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

##### Share on other sites
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

##### Share on other sites
Any suggestions? really need help on this.. still scanning through msdn just incase i missed something.