Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

DerMeister

CreateTextureFrom file doesn't work

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

Hi there... I have a weird problem here, I have a simple "terrain" class (24 rows* 24 cols) that has to load a texture from a file. I use bmp and dds formats, but the problem is that when I use this class for an win32 app project (exe file) it works perfectly, but now I use the class in a win32 dll (a winamp plug-in) and D3DXLoadTextureFromFile does not load any texture neither does D3DXLoadTextureFromFileEx, even using the same parameters. I have checked the return value of both functions and none of them is valid, which in my switch call jumps directly to the default case (so it''s not D3DERR_NOTAVAILABLE or another). Please help if you had these problem before, or if you know another way of solving it. No matter where you go... &this

Share this post


Link to post
Share on other sites
Advertisement
Have you made sure you''re using the correct path to load the file? Since it''s a .dll, the running directory might be different (wouldn''t know, I havn''t done any .dlls yet.).

Make sure you use C:\whatever\whatever.bmp to load the files. Maybe that''ll help.

Share this post


Link to post
Share on other sites
Oh, thanks for the advice, but yes, I used the correct path. I think is a wierd problem with the function, it seems it is not perfect, because I remeber reading somewhere in the sdk help, that if it does not load the texture, the programmer has to load it manually (what does it mean??? do I have to use a surface like in dx 7?)
Anyway, thanks...

No matter where you go... &this

Share this post


Link to post
Share on other sites
Be sure you use this slash: /, or twice the other one \\

So:
C:\\whatever\\text.bmp
or:
C:/whatever/text.bmp
BUT NOT:
C:\whatever\text.bmp!

Share this post


Link to post
Share on other sites
Thanks H4ck3r, you opened my eyes... I put my dds file in my c: and used "c:\\texture.dds" and it worked perfectly, now I have to figure out how to find my dll current directory...

No matter where you go... &this

Share this post


Link to post
Share on other sites
quote:
Original post by DerMeister
Thanks H4ck3r, you opened my eyes... I put my dds file in my c: and used "c:\\texture.dds" and it worked perfectly, now I have to figure out how to find my dll current directory...

No matter where you go... &this


Lol

Reminds me of a time I spent hours debugging something, only to realise that I had the wrong path and that is why it was crashing.

Whoda thunk.

Share this post


Link to post
Share on other sites
You don''t have to get your program''s path. If your program is located at C:\test\ and your texture is located in C:\test\textures\test.bmp, you can just use CreateTextureFromFile with the file textures/test.bmp or textures\\test.bmp...

Share this post


Link to post
Share on other sites
If it''s a .dll though, I think you''ll start from Winamp''s path, and not the .dll file''s path. Not really sure though.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!