Multi-texturing Problems in DX8 (Lightmaps)

Started by
1 comment, last by Aphelion 20 years ago
Hey, I'm trying to render a black and white light map onto a textured wall, but I can't get D3D behave correctly. Here's my code:

pD3DDevice->SetTexture(0, pTextureBuffer[0]);
pD3DDevice->SetTexture(1, pTextureBuffer[texcat]);

pD3DDevice->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
pD3DDevice->SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
pD3DDevice->SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);

pD3DDevice->SetTextureStageState(1,D3DTSS_COLORARG1, D3DTA_TEXTURE);
pD3DDevice->SetTextureStageState(1,D3DTSS_COLORARG2, D3DTA_CURRENT);
pD3DDevice->SetTextureStageState(1,D3DTSS_COLOROP, D3DTOP_MODULATE);

pD3DDevice->SetStreamSource(0, pVertexBuffer[vtxcat], sizeof(VERTEX));
pD3DDevice->SetIndices(pIndexBuffer[vtxcat], 0);
pD3DDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, vtxnum, 0, trinum);
 
Currently this outputs a lightmap texture with a tint that is the general color of the wall. Making the lightmap the top layer and the bottom layer the texture results in blackness. Any suggestions? Thanks [edited by - aphelion on April 13, 2004 8:44:54 PM]
| The Hitchhiker''s Guide to Programming |"That is not dead which can eternal lie,And with strange aeons even death may die."-H.P. Lovecraft
Advertisement
It''s probably that you have one set of UVs and aren''t telling D3D to use the first set on the second stage.

pDev->SetTextureStageState(1, D3DTSS_TEXCOORDINDEX, 0)

Alright Namethatnobodyelsetook!
Worked awesomely... thanks!
| The Hitchhiker''s Guide to Programming |"That is not dead which can eternal lie,And with strange aeons even death may die."-H.P. Lovecraft

This topic is closed to new replies.

Advertisement