Archived

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

soreno

load raw texture from ressource

Recommended Posts

the following code attempt to load a RAW bitmap (RGB: 600x450@8)file from a ressource: HRSRC hResInfo = NULL; HGLOBAL hResData = NULL; VOID* pvRes = NULL; GLubyte* pbRes = NULL; hResInfo = FindResource(NULL, "IDR_RAW", TEXT("RAW")); hResData = LoadResource(NULL, hResInfo); pvRes = LockResource(hResData); pbRes = (GLubyte*)pvRes; glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glBindTexture(GL_TEXTURE_2D, m_backgroundTex); gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGB, 600, 450, GL_RGB, GL_UNSIGNED_BYTE, &pbRes); but the last line produces a "The memory could not be read", what could be wrong?

Share this post


Link to post
Share on other sites
The code you posted (the windows part anyway) only finds the location of the resource in your excutable, loads and gets the address in memory to it. You still have to read the file data from that given address yourself. Cant expect opengl to do all the work.

Share this post


Link to post
Share on other sites