Skip to main content
gamedev.net
🔒 Locked

Scrolling Textures

Started by Klown9 0 replies 300+ views
Original Post
Klown9
Klown9
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);
    g_pD3DDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP,0,2);

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

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.