Thread: help

  1. #1
    Banned
    Join Date
    Oct 2004
    Posts
    250

    help

    Code:
    D3DXMATRIXA16 world;
    Does this just declare a 2d 4x4 world?. what is the differnce between this
    Code:
    D3DXMATRIX matWorld;
    Code:
    sDevice->DrawPrimitive(D3DPT_TRIANGLELIST,1,1)
    What do the parameters of this do? i noticed if i change the first 1 to 2 the triangle wont draw.

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Do you have the chm file that came with the DirectX SDK? It's the help file that contains all of the answers you are looking for. In case you don't have it, I'll answer them anyways, but in the future it is a brilliant resource for you.

    Basically the D3DXMATRIXA16 is a 16-byte aligned matrix that will improve performance on Pentium 4 processors. Other than that, it is the same as D3DXMATRIX. I always use A16 personally.


    DrawPrimitive:

    First parameter is the primitive type, triangle list, triangle strip, lines, etc.

    Second parameter is the start vertex index. This is just an offset into the vertex buffer on where to begin retrieiving the vertex data.

    Third parameter is the number of primitives to draw. Pretty self explanatory.

    Consult the SDK help file if you need further details. PRE.clsCode { font-size:110%; } PRE.clsSyntax { font-size:100%; } TD DIV.clsBeta { display:none;} // // // // // //
    PRE.clsCode { font-size:110%; } PRE.clsSyntax { font-size:100%; } TD DIV.clsBeta { display:none;} // // // // // //

    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  3. #3
    Banned
    Join Date
    Oct 2004
    Posts
    250
    thanks for the help MrWizard
    im trying to draw half a 3D pyramid but it only draws one of the triangles what am i doing wrong?

    Code:
    tVertex vertexarray[6] ={
    
    
    	{1.0f,0.0f,0.0f, D3DCOLOR_RGBA(200,0,0,0)},
    	{-1.0f,0.0f,0.0f,D3DCOLOR_RGBA(200,0,0,0)},
    	{0.0f,1.0f,0.0f, D3DCOLOR_RGBA(200,0,0,0)},
    
    	{1.0f,0.0f,0.0f, D3DCOLOR_RGBA(0,200,0,0)},
    	{1.0f,0.0f,0.0f, D3DCOLOR_RGBA(0,200,0,0)},
    	{0.0f,1.0f,0.0f, D3DCOLOR_RGBA(0,200,0,0)}
    
    };
    Code:
    D3DXMATRIXA16 matWorld;
    	D3DXMATRIXA16 matRotate;
    	D3DXMATRIXA16 matTranslation;
    
    	sDevice->BeginScene();
    
    	sDevice->SetFVF(D3DFVF_XYZ|D3DFVF_DIFFUSE);
    	sDevice->SetStreamSource(0,pVertexBuffer,0,sizeof(tVertex));
    
        D3DXMatrixRotationY(&matRotate, D3DXToRadian(fRotate));
    	D3DXMatrixTranslation(&matTranslation, 0.0f,0.0f,6.0f);
    	matWorld = matRotate * matTranslation;
    
    	sDevice->SetTransform(D3DTS_WORLD, &matWorld);
    	sDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, 0,2);
    
    
    	sDevice->EndScene();
    
    	fRotate -= 1.0f;
    	sDevice->Present( NULL, NULL, NULL, NULL );

Popular pages Recent additions subscribe to a feed