Jump to content
  • Advertisement
Sign in to follow this  
handsomekorean

Problems loading Textures from file with directx10

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

Hey guys,

finally decided to post this because I could not find a solution from anywhere else.
My problem is that when I try to load a texture bmp file and create a shader resource with it and click run, I get the error message saying that creation of the shader resource view has failed (""Could not load texture: %s!").

I'm pretty sure this is a simply a problem of putting my texture files in the wrong directory. I set the Debug--> Vc+ directory-> Executable Directories to the path where my bmp textures are located, but it still gives me the same error message.

BTW, I am using Visual studio 2010

here's a screenshot of my layout and shader resource view creation code

JcAut.png

Share this post


Link to post
Share on other sites
Advertisement
Hi,

Well then, have you checked the exact error code from the function call since FAILED() can mean many things.

Best regards!

[edit] Ok, I can see that you have copied the source from some D3D10 tutorial. Ensure that the file locations are correct.

Share this post


Link to post
Share on other sites
I understand that the problem has something to do with the files not being in the right location.

I put the textures files in c://my documents/Visual studio/project name/project name/ Debug, and set the executable directories to that pathway, but I am still having this problem.

Here's the error message.

[color=#FF0000]First-chance exception at 0x00c11f28 in tutorial.exe: 0xC0000005: Access violation reading location 0x00000000.
Unhandled exception at 0x00c11f28 in[color=#ff0000] tutorial[color=#ff0000].exe: 0xC0000005: Access violation reading location 0x00000000.

Share this post


Link to post
Share on other sites
Can you run your program under debugger line by line to see where you get the access violation? In the first message you didn't mention the access violation.

so if your .exe-file is under /debug directory, your textures should be under /debug/textures

You can also try to put the texture in the same directory as your .exe file and remove the path from the file names.

Best regards!

Share this post


Link to post
Share on other sites
Wow thanks I just put the texture files in the same directory as the .exe file( visual studio 2010/projects/tutorial/tutorial and removed the path from the file names

and it works.


Can't believe it tooke me 3 hours to figure this out...Wish the books that I am reading covered stuff like this.

Just another stupid question. How do I find out where the .exe file is? Do I set the pathway under Project manager- DEbug- VC++ directories--> Executable Directories?
If this is the case, I set the pathway for executable directories as C:\Users\Loo\Documents\Visual Studio 2010\Projects\tutorial\tutorial\Debug;$(ExecutablePath), but my texture files are in C:\Users\Loo\Documents\Visual studio 2010/tutorial/tutorial/), so I am a little confused.

Thanks for the help.

Share this post


Link to post
Share on other sites
You don't have touch the VC++ Directories, they contain things like where to find the .exe-files related to the Visual Studio such as compilers or include files for different libraries (DirectX). Be careful with the VC++ directories, you may render your Visual Studio non-working.

Under Configuration Properties / General you should be able to find the "output directory" and "target name" which define the location and name of the file.

Cheers!

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!