Jump to content
  • Advertisement

Archived

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

-X-Modena-X-

Texture Moving

This topic is 6194 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 been fighting with a program for a couple weeks now. What I have is a cylender. I want to move the texture up and down along the cylender. The texture is alot longer then the circumfrence of the cylender so I can''t just rotate the cylender. I was wondering if anyone could help me out with this problem. The cylender is in .x format with the texture assigned to it. All I need to do is change where exactly the texture is on the cylender.

Share this post


Link to post
Share on other sites
Advertisement
you can move textures just like any object,
first, you must do that:
D3dDevice->SetTextureStageState( D3DTSS_TRANSFORMFLAGS, //some of the flags here);

then you can directly move your texture:
D3DXMATRIX trans;
D3DXMatrixTranslation( &trans, 0.0f, 0.0f, 10.0f ); // 10 along the Z- axis
-and then you cast the matrix to the textures:
D3dDevice->SetTransform( D3DTS_TEXTURE0, &trans);

just ask if you need more help
http://aminouch.tripod.com


Share this post


Link to post
Share on other sites
Ok, I just have one more question. What D3DTSS_TRANSFORMFLAGS flags do you use to get the textures to shift? I have been playing around with and I don''t get any errors, but the textures just will not move.

Share this post


Link to post
Share on other sites
quote:
Original post by -X-Modena-X-
Ok, I just have one more question. What D3DTSS_TRANSFORMFLAGS flags do you use to get the textures to shift? I have been playing around with and I don''t get any errors, but the textures just will not move.


If you have a look through the DirectX docs there should
be information on how to do this. One thing to note though
is that texture transformation matrices put the offsets
into row 3 (2 in c) and not 4 (3 in c) as normal view/world
transformations.
i.e. to move a texture up by 0.5 you would need a matrix

1 0 0 0
0 1 0 0
0 0.5 1 0
0 0 0 1

you will also want to put in
D3dDevice->SetTextureStageState( 0, 3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT2 );

To make the device transform the stage 0 texture co-ordinates and
pass them through to the rasterizer.

Hope this helps

MrF.



MrF.
--
Code..reboot..code..reboot..sigh!

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!