if (D3D_OK != D3DXCreateTextureFromResource(DXStuff->g_pd3dDevice,
NULL,
MAKEINTRESOURCE(IDR_JPEG1),
&DXEnts->BlockGroup.g_QuadsTB.Texture))
{
wsprintf(DXStuff->critErrorCap, "%s", "CreateTexBuffer");
wsprintf(DXStuff->critErrorText, "%s", "CreateTexBuffer: Couldn't find resource?");
return 1;
}
In my CPP environment, I right-clicked in my Resources to "Add Resource..." and then created a custom one called 'Jpeg'. I put the file 'resources\init.jpg' into it, and my CPP environment showed a bunch of binary data instead of the image in the IDE, so I know it loaded something. I then compiled the executable, and it increased in size in relation to the size of the file 'init.jpg', so I know that the jpeg data got compiled into the executable. The ID for my jpeg resource is IDR_JPEG1.
How do I get the above to load the texture stored in the resource 'IDR_JPEG1' into my Direct3D texture buffer? And if the above is correct, how do I add a 'jpeg' or 'tga' resource to my program so that I can use it for the above texture loading function?
Thanks in advance for the help, I really appreciate it!
Easy 'load texture from resource' question...
Here's an easy one! I've never done this before, and I don't really know where to start, and I can't find anything on Google that I can make heads or tails out of, and I like to make sentences run forever and ever, so I though I'd ask the experts.
Here's some sample code that doesn't work, because I'm sure I'm doing something wrong...
Look in your rcfile - open it manually. Your line with the .jpg file should read something like:
IDR_JPEG1 rcdata "<either relative or absolute path.jpg>"
Unfortunately the newer versions (don't know about 2005) of VS .net corrupt this line when you try to add the resource in the way you specified. Simply fix the .rc file manually and you'll be set. Sadly I haven't found a better fix yet.
Good luck!
IDR_JPEG1 rcdata "<either relative or absolute path.jpg>"
Unfortunately the newer versions (don't know about 2005) of VS .net corrupt this line when you try to add the resource in the way you specified. Simply fix the .rc file manually and you'll be set. Sadly I haven't found a better fix yet.
Good luck!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement