Jump to content
  • Advertisement
Sign in to follow this  
Baris YILMAZ

File Path Issue using D3DXCreateTextureFromFileA(...)

This topic is 2519 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 project directory is "D:\Github Project\Game-Engine". If i put my resource files in project directory like; "D:\Github Project\Game-Engine\car.jpg" and write the code below:


D3DXCreateTextureFromFileA(m_d3d, "car.jpg" , &m_Texture);


it works!!!

But when i try to put all my resource files to another directory like Resources "D:\Github Project\Game-Engine\Resource", whatever i try as file path, it did not work.

Put "car.png" in directory Resource "D:\Github Project\Game-Engine\Resource\car.png" and write the codes below:



D3DXCreateTextureFromFileA(m_d3d, "D:\\Github Project\\Game-Engine\\Resource\\car.jpg" , &m_Texture);
D3DXCreateTextureFromFileA(m_d3d, "D:\Github Project\Game-Engine\Resource\\car.jpg" , &m_Texture);
D3DXCreateTextureFromFileA(m_d3d, "..\Resource\\car.jpg" , &m_Texture);


Unfortunately none of them is worked..
Could anyone help me pls?

Thankss

Share this post


Link to post
Share on other sites
Advertisement
You're saying that it's called "car.png", but your paths all have "car.jpg" on them.

Share this post


Link to post
Share on other sites

"..\Resource\\car.jpg" is close. You actually want "Resource\\car.jpg".


i've tried but did not work :/ i could not find any project that put resources on another directory except root directory

Share this post


Link to post
Share on other sites
Link with d3dx9d.lib rather than d3dx9.lib in Debug builds - that will give you useful information in the debug output window when a D3DX function fails. If the car.jpg file is in a directory called Resource, in the same directory as your project (Not nessecarily the same directory as your solution), then "Resource\\car.jpg" will refer to that file. If it's not loading, it sounds like there's some other issue (File contains bad data, for instance).

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!