Sign in to follow this  

Texture.FromFile() method producing peculiar results

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

This topic is 2544 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this