Skip to main content
GameDev.net gamedev.net
🔒 Locked

File Path Issue using D3DXCreateTextureFromFileA(...)

Started by Baris YILMAZ Jan 15, 2012 at 12:25 PM 4 replies 2.3k views
Original Post
Baris YILMAZ
Baris YILMAZ
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
MJP
MJP
You're saying that it's called "car.png", but your paths all have "car.jpg" on them.
Baris YILMAZ
Baris YILMAZ
i mean i try every [color=#000000][font=arial, sans-serif]

alternative way (3 of them) that i can think of..[/font]

Evil Steve
Evil Steve
"..\Resource\\car.jpg" is close. You actually want "Resource\\car.jpg".
Baris YILMAZ
Baris YILMAZ

"..\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
Evil Steve
Evil Steve
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).

Topic Locked

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

Sign in to reply to this topic.