Texture.FromFile() method producing peculiar results

Started by
1 comment, last by Tigran 13 years, 3 months ago
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
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?
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.

This topic is closed to new replies.

Advertisement