Jump to content
  • Advertisement
Sign in to follow this  
ginzorf

Texture.FromFile() method producing peculiar results

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

I'm working with DirectX 9.0 SDK using Visual Studio 2008, on Windows 7, ATI Radeon HD 5800. I have VS configured to produce a 32-bit application.

I am updating (for my own notes, and course material I'm working on) code from the book "Beginning C# Game Programming" by Ron Penton.

I use a version of the function FromFile, used in the book (I've updated my material for the shortened, overloaded version with only two parameters as of 2.0 instead of the 11 parameter version that was the only one available with .NET 1.0)

texture = Direct3D.TextureLoader.FromFile(graphics, "texture.jpg");

Simple code, right? Well, everything compiles. When I run it, instead of seeing the texture ( a brick wall image), I see a pukish beige instead.

Here is the brick on the left, my screen shot on the right if you're interested:

http://img259.imageshack.us/i/brickanddisplay.jpg/

Any ideas as to why this might be happening? The vertices I'm using are created with a type of Direct3D.CustomVertex.TransformedTextured as the book recommended.

I've tried saving the image as a .bmp, a 256-color .bmp, etc... nothing seems to be working. Any help would be appreciated!

Thanks,

Ginzorf

Share this post


Link to post
Share on other sites
Advertisement
We're going to need a bit more code to solve the problem.

How are you creating your vertices? Are the TexCoords on your vertices correct?

Share this post


Link to post
Share on other sites
I agree with adt7, post some of your drawing code.

Maybe you could convert the image into a .dds
There is a utility program that comes with the directx sdk that can help you with that.

And you might want to load using the D3DXCreateTextureFromFile Function. Atleast, that's the one I use, and never got a problem with it.

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.

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!