Skip to main content
gamedev.net
🔒 Locked

Create texture from resource

Started by Zulkhairi Feb 22, 2007 at 12:42 AM 3 replies 2.6k views
Original Post
Zulkhairi
Zulkhairi
I got a problem in understanding about create texture from resource, from what i understand, after we create the texture, it will be copied to the memory right, then automatically it will be 'pasted' to the back buffer. Then we can use it just like the create texture from file. Ok, here's the thing, just tell me that my understanding is wrong. Because i cant seems to make it works. I'm trying to create a texture from resource, and i need to make it displayed just like the normal texture. It is because i need to test whether the driver is displaying the right texture or there is some texture corruption happen. Can somebody please help me in this. Could someone show me the right way to use D3DXCreateTextureFromResourse(), and teach me how to use it just like the normal texture. Thanks in advance.
StratBoy61
StratBoy61
Hey Zulkhairi,

I was sure I had something in my code junk about D3DXCreateTextureFromResource(), but it happened to be D3DXCreateEffectFromResource() !! Anyways, it might be worth a peek, as you have to specify RCDATA as the resource type for the above to work...
You can check it on this previous thread...

The texture is embedded in a resource, as an icon or cursor would be, in your exe or dll. You just access it from there, rather than from the disk.

This other thread shows you an example of how to use D3DXCreateTextureFromResource().
Hope this helps,
Cheers
Sc4Freak
Sc4Freak
Quote:
Original post by Zulkhairi
I got a problem in understanding about create texture from resource, from what i understand, after we create the texture, it will be copied to the memory right, then automatically it will be 'pasted' to the back buffer.


Not really. The back buffer is what is going to be displayed on the screen - you render to the back buffer. The texture itself, when created, resides somewhere in memory (probably in video memory).

But yes, both D3DXCreateTextureFromResourse and D3DXCreateEffectFromFile will allow you to use the texture in exactly the same ways.
StratBoy61
StratBoy61
Quote:
Original post by Sc4Freak
But yes, both D3DXCreateTextureFromResourse and D3DXCreateEffectFromFile will allow you to use the texture in exactly the same ways.

should read D3DXCreateTextureFromResource & D3DXCreateTextureFromFile ;)
Zulkhairi
Zulkhairi
Thank you to all of you. I finally being able to make it works. Many thanks for the advice.

Regards,
Zulkhairi

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.