Jump to content
  • Advertisement


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


Scrolling Textures

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

Im trying to make a texture scroll across a textured quad but its not moving. The quad's FVF is (D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_TEX1) (the quad is in 2d for a menu background). Will this work with this vertex format? I have this working on 3d models but cant get this working no matter what I try. I was wondering if its the vertex format thats stopping me? Any other ideas if this isn't the case? I'm sure there is something I'm missing. This is the code I'm using:
//m_ScrollTrans is a global D3DVECTOR

//m_Scrollspeed is a global float 

//Matrix4x4To3x3 converts a 4x4 matrix to a 3x3 (this has been tested and works)

D3DXMATRIX matTrans;
    m_ScrollTrans.x -= m_ScrollSpeed * g_timerdiff;
    m_ScrollTrans.y -= m_ScrollSpeed * g_timerdiff;
    D3DXMatrixTranslation(&matTrans, m_ScrollTrans.x, m_ScrollTrans.y, 0.0f);
    Matrix4x4To3x3(&matTrans, &matTrans);
   g_pD3DDevice->SetTransform( D3DTS_TEXTURE0, &matTrans);
    g_pD3DDevice->SetTextureStageState( 0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_COUNT2);
    //Render the scrolling texture

    g_pD3DDevice->SetStreamSource(0, m_ScrollVB, sizeof(C2DVertex));
    g_pD3DDevice->SetTexture(0, m_ScrollTexture);

Any help is greatly appreciated, Harley. BreakoutX [edited by - klown9 on December 1, 2003 4:12:25 AM]

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!