Sign in to follow this  
L. Spiro

Setting Matrices for Texture Coordinate Generation

Recommended Posts

So if I use:
IDirect3DDevice9::SetTextureStageState( 1, D3DTSS_TEXCOORDINDEX, (1 | D3DTSS_TCI_CAMERASPACEPOSITION) );
How do I set the matrix it uses to generate these coordinates? If I am going to do shadow-mapping I want the coordinates to be transformed as a projection from the light source. So I need a way to set the matrix values to be used with this automatic generation. L. Spiro

Share this post


Link to post
Share on other sites
You'll want to set stage 1's D3DTSS_TEXTURETRANSFORMFLAGS to D3DTTFF_COUNT4 | D3DTTFF_PROJECTED to activate the matrix and projection mode. And to set the matrix, you use SetTransform(D3DTS_TEXTURE1, &matrix);. Remember to set the texture transform flags back to D3DTTFF_DISABLE when you're done, so as not to muck up any other code using a texture in stage 1.

NOTE: I'm not guaranteeing the accuracy of the names provided, as it's from memory, but the help and/or Intellisense will quickly fix any misspellings for you.

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