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

IDirect3DIndexBuffer8::Lock

Started by Sarge Dec 19, 2002 at 4:38 AM 0 replies 300+ views
Original Post
Sarge
Sarge
Hello again, well I''m stuck on a performance problem. I have several objects in my 3DWorld consisting of around 200 - 600 Triangles (I''m not using too models with higher polycounts). All together I have around 2500 triangles which must be displayed each frame. Each object has one material and one texture attached to it at the moment. So I decided to call IDirect3DIndexBuffer8::Lock for each object I draw and then to call DrawPrimitive. Here''s a code snippet of what I mean: // Fill the vertex buffer. // p_Count: number of vertices VOID* pVertices; if (FAILED (m_pDirect3DVertexBuffer8->Lock (0, p_Count * sizeof (D3DVertex), (BYTE**) &pVertices, D3DLOCK_DISCARD))) { return OWL_DX_VERTEXBUFFER_LOCK_FAILED; } memcpy (m_pVertices, p_pVertices, p_Count * sizeof (D3DVertex)); m_pDirect3DVertexBuffer8->Unlock(); // Render the vertex buffer contents m_pDirect3DDevice8->DrawPrimitive (D3DPT_TRIANGLELIST, 0, p_Count / 3); When it came to execution of my programm I figured that this way of drawing is terrible slow. I get 2 - 6 frames per second for around 2500 triangles. So my question is what I could do to optimize this. I''m actually reading about ways to render triangles but I have not yet found the most efficient way. If I find it I''ll post it here but I would be very thankfull if you could help me. Thanks a lot in advance and merry christmas Greetings Sarge

Topic Locked

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

Sign in to reply to this topic.