Multiple Texture Coordinates in D3D7

Started by
0 comments, last by mitchw 24 years ago
I am trying to do lightmapping in my program. So here is my vertex structure: typedef struct _SK_VERTEX { float x, y, z; // Position float tu, tv; // Texture Coord float lu, lv; // Lightmap Coord } Here is my vertex format (I''ve tried both, same results) #define SK_VERTEXFORMAT ( D3DFVF_XYZ / D3DFVF_TEX2 ) - or - #define SK_VERTEXFORMAT ( D3DFVF_XYZ / D3DFVF_TEX2 / D3DFVF_TEXCOORDSIZE2(0) / D3DFVF_TEXCOORDSIZE2(1) ) And my texture portion of the rendering: pDevice->SetTexture( 0, p->Texture ); if ( p->Lightmap ) { pDevice->SetTexture( 1, p->Lightmap ); pDevice->SetTextureStageState( 1, D3DTSS_COLOROP, D3DTOP_MODULATE ); } The problem is that the lightmap appears to be using the normal Texture coordinates as well. For example. if my texture is scaled down (coords of 0.0 to 8.0), then the lightmap is also scaled (and duplicated). So whats wrong is there something else I have to tell D3D to do Single-Pass Texture Blending? Thanks
Advertisement
I believe you''ll need to include this line

pDevice->SetTextureStageState(1, D3DTSS_TEXCOORDINDEX, 1);

to get D3D to use the second set of texture coordinates for your lightmap. I''m not sure though as I haven''t tested it.

/ WitchLord

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

This topic is closed to new replies.

Advertisement