Jump to content
  • Advertisement
Sign in to follow this  
deathkrush

OpenGL [MDX] Texture transformation matrix

This topic is 4488 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

In OpenGL I could do texture transformations easily to achieve a simple smoke or water effect. In Managed DirectX I'm ripping my hair out. How do you translate the texture coordinates? For instance, this code (C#) has absolutely no effect:
device.TextureState[0].TextureTransform = TextureTransform.Count2;
device.Transform.Texture0 = Matrix.Identity;
device.Transform.Texture0 *= Matrix.Translation(x, y, z);

However, this code seems to be scaling texture coordinates properly:
device.TextureState[0].TextureTransform = TextureTransform.Count2;
device.Transform.Texture0 = Matrix.Identity;
device.Transform.Texture0 *= Matrix.Scaling(scale, scale, scale);

I have a feeling that the DirectX texture transformation matrix is different from OpenGL one, but I can't find any useful documentation about it.

Share this post


Link to post
Share on other sites
Advertisement
Quote:
When we translate 3D objects, the translation values are found in the fourth row of the world transformation matrix. However, since textures are specified in a 2D coordinate space, the translation values in the texture transform matrix are located in the third row of the texture transform matrix.


That explains why Translate operation has no effect! Thanks for the tutorial.

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!