Jump to content
  • Advertisement

Archived

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

HexDump

transformed vertices + transformations problem

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

Hello everybody, Here is some code I use in order to render a quad with transformed vertices: //Setting up d3d to use this kind of vertices struct t2DVertex { float X,Y,Z,RHW; DWORD Color; float Tu,Tv;}; #define FVF_2DVERTEX (D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_TEX1); //Code used to render the quad //Some code to set up rendering, NO CUlling, etc... //Set Project and View Transformation matrices D3DXMATRIX matProj; D3DXMatrixOrthoLH(&matProj,640,480,1.0f,3000.0f); pDevice->SetTransform(D3DTS_PROJECTION, &matProj); D3DXMATRIX matView; D3DXMatrixLookAtLH(&matView, &D3DXVECTOR3(0.0f, 0.0f, 1.0f), &D3DXVECTOR3(0.0f, 0.0f, 20.0f), &D3DXVECTOR3(0.0f, 1.0f, 0.0f)); pDevice->SetTransform(D3DTS_VIEW, &matView); /*D3DXMATRIX TransMatrix; D3DXMatrixIdentity(&TransMatrix); D3DXMatrixRotationZ(&TransMatrix,45*D3DX_PI/180); pDevice->SetTransform(D3DTS_WORLD, &TransMatrix);*/ pDevice->SetTexture(0,pTexture); pDevice->SetFVF(FVF_2DVERTEX); pDevice->DrawPrimitiveUP (D3DPT_TRIANGLESTRIP,2,m_Verts,sizeof(t2DVertex)); Well, this is what I use. The problem is that when I don´t use transformed vertices the Rotation (code commented) is performed but when I use transformed vertices (like in this example) it doesn´t, same ocurrurs when doing translations. Can anybody tell me why could this happend? Thanks in advance. HexDump.

Share this post


Link to post
Share on other sites
Advertisement
Transformed vertices are just that. When you use them you''re telling D3D "don''t apply ANY transformations to these vertices because they are already TRANSFORMED ".

--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites
So, in order to translate vertices, etc... I must change coordinates in the buffer itself?

Thanks.


HexDump.

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!