Thread: i cant seem to be able to make transformations with each mesh with directx

  1. #1
    Registered User
    Join Date
    Nov 2002
    Posts
    319

    i cant seem to be able to make transformations with each mesh with directx

    i load 2 meshs extract its material then in render i have

    g_pDirect3DDevice->SetMaterial( &pMeshMaterials[i] );
    g_pDirect3DDevice->SetTexture( 0, pMeshTextures[i] );

    now i want to use matrices to move each mesh diferent ways when a key is pressed , but for some reason both meshs move the same direction when a key is pressed , so i am thinking do you have to

    g_pDirect3DDevice->BeginScene();
    InitMatrices();
    RenderMesh1();
    g_pDirect3DDevice->EndScene();
    g_pDirect3DDevice->BeginScene();
    InitMatrices();
    RenderMesh2();
    g_pDirect3DDevice->EndScene();

    g_pDirect3DDevice->Present(NULL,NULL,NULL,NULL);

    otherwise i cant think how i would make both meshs move diferently to 1 another
    thanks

  2. #2
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Each mesh must have it's own transformation matrix. The transformation matrix is the concatenation of all the scaling, rotation, translation, skew, etc, matrices. So each mesh needs it's own translation matrix.

    So you translate, draw, translate, draw, etc, etc.

    How complex this process is depends on what type of architecture you have implemented in your game engine.


    To me it looks as if you are using the same translation matrix for mesh 1 and 2 which is exactly what you are seeing on screen. How does InitMatrices() know which mesh you are referring to and what relation do the matrices have to the mesh?

    This is a very good place for C++ object oriented programming.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C# and DirectX Downloads? (Simple Q, Please reply)
    By Zeusbwr in forum Windows Programming
    Replies: 2
    Last Post: 05-06-2005, 09:31 AM
  2. DirectX transformations
    By confuted in forum Game Programming
    Replies: 9
    Last Post: 08-02-2003, 07:41 PM
  3. 'functions' in make?
    By mart_man00 in forum C Programming
    Replies: 1
    Last Post: 06-21-2003, 02:16 PM
  4. Directx SDK Documentation
    By Zoalord in forum Game Programming
    Replies: 4
    Last Post: 05-08-2003, 06:07 AM
  5. a mesh tool for directx
    By darcome in forum Game Programming
    Replies: 2
    Last Post: 03-11-2003, 06:27 AM