Jump to content
  • Advertisement
Sign in to follow this  
Quat

Effect from Resource

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, Right now I am using .fx files for my effects. However, I only have a few .fx files for my application and I'd rather just embed them in the EXE as a resource. But I am not sure how to do this. In Visual Studio, do I just right click on the project > Add Resource > Import, and import the .fx file? Then how do I get a string/pointer to the resource to pass to D3DXCreateEffectFromResource?

Share this post


Link to post
Share on other sites
Advertisement
I don't know much about adding resources to projects, I'm afraid. But the normal way of getting a pointer to a resource is MAKEINTRESOURCE(resourceId). That returns LPSTR.

If I remember (from the old days), when you import it, you'll have to give it a custom resource type. You can use something like RCDATA (which was actually recognized as a resource in the "old" days). It will be given a resource id. ID_RCDATA1 or something, which you can use in the MAKEINTRESOURCE call.

If I also remember correctly, that resource will be deleted from your resources whenever you add or create another resource since RCDATA is not recognized as a valid resource type. I think the way to hack around that is to create another resource file (.rc2) and copy and paste the RCDATA into it. Text edit the project .rc file and add a line "#include "whatever.rc2"

Try it out in a COPY of your project FIRST! Text editing resource files is not for the novice!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!