Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Multiple Texture Coordinates in D3D7

This topic is 6788 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post

Link to post
Share on other sites
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

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!