Jump to content
  • Advertisement
Sign in to follow this  
vidalsasoon

HLSL files and absolute texture paths.

This topic is 4668 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

My effect files have params like: string ResourceName = "default_color.dds"; The problem is that if I want to use these files, I have to alter the ResourceName to an absolute path. This is extremely tedious. Is there anyway I could just leave my file paths as they are, leave the texture file in the same directory as the fx file and be happy? Thanks, V

Share this post


Link to post
Share on other sites
Advertisement
Good day Vidalsasoon,
How are you doing?

The Problem
Structure and absolute paths

The Solution
There are a couple of ways to do this.
1) You could prefix all the texture filenames with a path... Let's say you have a texture loader method you would just do,

const string texturePath = "Resources/textures";
void TextureLoader(IDirect3DDevice9* pDevice, string srcFilename)
{
D3DXCreateTextureFromFile(pDevice, texturePath + srcFilename);
}



Say may agree that this is ugly but it works and it's one way to resolve your problem.

Thing about this is that you don't want all your resources in one directory. This might become messy and unstructured.

Directory Structure example
-Resources
--textures
--models
--shaders

It makes things a little easier to manager in the long run.

Take care buddy, I hope this helps a bit.
PS: to answer your question, you could probably put everything in the debug/release directories and just use the filepaths you are using now :)

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!