Sign in to follow this  
Quat

Effect from Resource

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this