Sign in to follow this  

Colors flipped in image

Recommended Posts

I have no idea what's causing this. Left is the photoshop image, right is the image rendered in-game with DirectX it's not two images one on top of the other, it's the same image. The colors of the rectangle are flipped for some reason. Any idea as to what may be causing this? Thanks.

Share this post

Link to post
Share on other sites
Thats because DirectX uses a different texture coordinates system.

Try this in your vertex shader:

//set vertex shader out texture coordinates
vOut.texC = vIn.texC;
//inverse y value of texture coordinates
vout.texC.y = (1 - vOut.texC.y);

Share this post

Link to post
Share on other sites
I don't think I am using any vertex shaders :S. I am using ID3DXSprite in case it's related.

Edit: solved, for some reason I didn't notice that everything was flipped not just the blue rectangle, sorry.

Though now I am a little confused. Is bottom supposed to be the greater value and top the smaller one?

void direct3d::set_view()
D3DXMATRIX matrix;

0, 2000,
0, 1);
d3d_device->SetTransform(D3DTS_PROJECTION, &matrix);

[Edited by - Antonym on May 1, 2010 5:58:09 PM]

Share this post

Link to post
Share on other sites

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