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

I'm doing something wrong (DX 8)?

Started by 24hCoder Jan 1, 2001 at 9:00 AM 3 replies 700+ views
Original Post
24hCoder
24hCoder
Is this the right way to render from index buffer (It doesn''t work) ? -Creating vertexbuffer -Filling vertexbuffer -Creating indexbuffer -Filling indexbuffer -Setting stream source -Setting index buffer source -Setting vertex shader -Rendering with drawindexedprimitive
Lars W.
Lars W.
HI

Maybe you should make your Question a bit more concret.
What isn''t working, is just everything Black, or does one of the Methods Fail ?

Lars
24hCoder
24hCoder
The last command drawindexedprimitive fails.
Theres no problem with drawindexedprimitiveUP thow, so I might have something wrong with the indexbuffer..

Just need to know is the basic idea right.
And is there some usage flag that I should include? (I''m using D3DUSAGE_WRITEONLY for both buffers)
Lars W.
Lars W.
It is fully correct you do it, here is my call to the necessary Functions, maybe it helps you
  
CreateVertexBuffer(VertexAnzahl*VertexSize,D3DUSAGE_WRITEONLY,Format,D3DPOOL_MANAGED,&D3DVertexBuffer );
...
Filling up the Buffer
...
CreateIndexBuffer(IndexAnzahl*2,D3DUSAGE_WRITEONLY ,D3DFMT_INDEX16,D3DPOOL_MANAGED,&D3DIndexBuffer);
...
Filling up the Buffer

And now the drawing Function...
  
D3DDevice->SetStreamSource(0,Mesh->D3DVertexBuffer,Mesh->VertexSize);
D3DDevice->SetIndices(Mesh->D3DIndexBuffer,0);
D3DDevice->SetVertexShader( Mesh->type );
D3DDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST,0,Mesh->VertexAnzahl,0,Mesh->IndexAnzahl/3);


That does it for me, hope it helps you.

Lars



Edited by - Lars W. on January 1, 2001 5:05:06 PM
24hCoder
24hCoder
THANK YOU very much Lars! It really works!
I still dont know what the problem was, maybe primitivecount, but it''s fixed now!

Topic Locked

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

Sign in to reply to this topic.