Jump to content
  • Advertisement
Sign in to follow this  
hermiteer777

Direct3D equivalent of Open GL texture matrix manipulation?

This topic is 4437 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 have some Open GL code I'm porting to Direct3D that has a textured quad where the texture is animated the opposite of the quad. For example, if the quad is rotated 90 degrees CW, the texture is rotated 90 degrees CW, given the effect that the quad has moved but the texture has stayed in place. I accomplish this in Open GL by glMatrixMode( GL_TEXTURE ), then calling glTranslatef(), glRotatef() and glScalef() which modifies the texture matrix. Simple eh? But I'm failing to do the same in Direct3D. If anyone can give some insight to the following questions, it'd be grand: 1) Do I need to add additional values to my vertex format (beyond tu and tv)? Currently I have: Vertex3D { float x, y, z; DWORD diffuse; float tu, tv; } 2) Should I simply do my own calculations for tu, tv or should I use SetTextureStageState( 0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT2 )? 3) If I use the above SetTextureStageState(), do I still need texture coordinate values in the vertex format? Thanks for your time, Christoph

Share this post


Link to post
Share on other sites
Advertisement
You can use a texture matrix by setting it using, device->SetTransform(D3DTS_TEXTURE0, &matrix) and setting the texture stage state you mentioned. Matrix calculations are normally done using D3DX functions, such as D3DXMatrixTranslation (see the D3D docs for more) and multiplied together to form one matrix.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!