Skip to main content
GameDev.net gamedev.net
🔒 Locked

vertex buffer

Started by thoue Nov 18, 2003 at 9:02 PM 1 replies 250+ views
Original Post
thoue
thoue
i have init some vertex (3 to amke a triangle) i wanna translate it from 0 to 180 then go back to 0 ... 180 ...0 void init(){ [..code..] //mostly copy paste from msdn CUSTOMVERTEX vertices[] ={ { 100.0f, 5.0f, 0.5f, 1.0f, 0xffff0000, }, { 100.0f, 100.0f, 0.5f, 1.0f, 0xff00ff00, }, { 5.0f, 10.0f, 0.5f, 1.0f, 0xff00ffff, }, }; Graphics()->GetDevice()->CreateVertexBuffer( 3*sizeof(CUSTOMVERTEX), 0 /* Usage */, D3DFVF_CUSTOMVERTEX, D3DPOOL_DEFAULT, &g_pVB, NULL ); VOID* pVertices; g_pVB->Lock( 0, sizeof(vertices), (void**)&pVertices, 0 ); memcpy( pVertices, vertices, sizeof(vertices) ); g_pVB->Unlock(); [..code..] } now im doing the redering void render(){ [..code..] static float total = 0.0f; total +=timeDelta; float dist = 1.1f + 80.0f * (1.0f + sin(total)); Graphics()->Clear(); Graphics()->BeginScene(); matrix4 mat; mat.toTranslation(point3(0.0f, 0.0f, dist)); Graphics()->SetWorldMatrix(mat); //I use this matrix pMat to see if the word mat work... ant it work. D3DMATRIX pMat; Graphics()->GetDevice()->GetTransform(D3DTS_WORLD, &pMat); Graphics()->DrawTextString(500,500, D3DCOLOR_XRGB(152,24,210), txtToDisplay.c_str()); Graphics()->GetDevice()->SetStreamSource( 0, g_pVB, 0, sizeof(CUSTOMVERTEX) ); Graphics()->GetDevice()->SetFVF( D3DFVF_CUSTOMVERTEX ); Graphics()->GetDevice()->DrawPrimitive( D3DPT_TRIANGLELIST, 0, 1 ); Graphics()->EndScene(); Graphics()->Flip(); [..code..] } //*****************// but here is the problem i have set the view matrix and the projection matrix. But nothing move in the scene. Only the triangle is show without moving. Is there somthing else i need to set other then the matrixs thoue [edited by - thoue on November 18, 2003 10:43:22 PM]
**THOUE***Spec:Intel: 2.8GHzAti Radeon 9800 pro1024mg RAMDevelopping C# DX 9.0c appsThx you!
Kalthorn
Kalthorn
"total += timeDelta"

Where is timeDelta initialized?
thoue
thoue
in the function

void DaFrame( time)

i fixed the problem i was using bad FVF for what i was trying to achive.

thx anyway
**THOUE***Spec:Intel: 2.8GHzAti Radeon 9800 pro1024mg RAMDevelopping C# DX 9.0c appsThx you!

Topic Locked

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

Sign in to reply to this topic.