Quad[0].Position.x = 0; Quad[0].Position.y = Size; Quad[0].TextureUV.x = 0; Quad[0].TextureUV.y = 1.0f; Quad[1].Position.x = 0; Quad[1].Position.y = 0; Quad[1].TextureUV.x = 0; Quad[1].TextureUV.y = 0; Quad[2].Position.x = Size; Quad[2].Position.y = Size; Quad[2].TextureUV.x = 1.0f; Quad[2].TextureUV.y = 1.0f; Quad[3].Position.x = Size; Quad[3].Position.y = Size; Quad[3].TextureUV.x = 1.0f; Quad[3].TextureUV.y = 1.0f; Quad[4].Position.x = 0; Quad[4].Position.y = 0; Quad[4].TextureUV.x = 0; Quad[4].TextureUV.y = 0; Quad[5].Position.x = Size; Quad[5].Position.y = 0; Quad[5].TextureUV.x = 1.0f; Quad[5].TextureUV.y = 0;
🔒 Locked
Texture UV problems
Advertisement
Original Post
Whats wrong with these Texture UV''s? I think I may have gotten them backwords. It is for a quad made up of 2 triangles in clockwise order:
The texture is loading find and setting fine but all I see it black on the quad when it gets rendered. These are pre-transformed verts, and all the colors are pure white (renders as a white square with no texture).
Im using triangle lists in my program right now, and I'm not interested in switching to strips because of the way everything is set up to render in batches. I've done it that way before on a test program, however.
Ok, I've been fooling around the UV coords for a while now and still nothing shows up except a black quad. I've checked my Loading function and its working fine, SetTexture is working fine, what else could it be?
[edited by - laroche on January 10, 2003 4:45:24 PM]
Ok, I've been fooling around the UV coords for a while now and still nothing shows up except a black quad. I've checked my Loading function and its working fine, SetTexture is working fine, what else could it be?
[edited by - laroche on January 10, 2003 4:45:24 PM]
I would guess that your Texture Stage States are wrong. Can you post what you''re setting them to?
Stay Casual,
Ken
Drunken Hyena
Stay Casual,
Ken
Drunken Hyena
Texture loading code:
And.. that''s it. I call SetTexture after it every frame, and then render. My normally white quad shows up as a black quad instead.
void CTexture::Load(char *Filename)
{
D3DXCreateTextureFromFileEx(pd3ddev, Filename, 0, 0, 0, 0,
D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, D3DX_DEFAULT,
D3DX_DEFAULT , 0, NULL, NULL, &pTexture);
}
And.. that''s it. I call SetTexture after it every frame, and then render. My normally white quad shows up as a black quad instead.
Try:
device->SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_SELECTARG1);
device->SetTextureStageState(0,D3DTSS_COLORARG1,D3DTA_TEXTURE);
Stay Casual,
Ken
Drunken Hyena
device->SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_SELECTARG1);
device->SetTextureStageState(0,D3DTSS_COLORARG1,D3DTA_TEXTURE);
Stay Casual,
Ken
Drunken Hyena
sorry if i seem pushy to bump, but I just cant figure this out, and it's such a silly problem i don't know why it isn't working. I've put error checking everywhere, and everything seems fine. The weird thing is that my quad apparently is drawing only the most top-left pixel in the texture. Why would it do that?
EDIT: I FIXED IT!!! I can't belive how stupid my error was, i was forgetting to copy my verts uv coordinates into the vertex buffer. How could I be so stupid? Anyway, thanks for the help anyway
[edited by - laroche on January 14, 2003 10:33:48 PM]
EDIT: I FIXED IT!!! I can't belive how stupid my error was, i was forgetting to copy my verts uv coordinates into the vertex buffer. How could I be so stupid? Anyway, thanks for the help anyway
[edited by - laroche on January 14, 2003 10:33:48 PM]
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement