About to say fuck it and switch back to opengl!
Dynamic buffer, dynamic buffer, dynamic buffer... Such a pain in the ass!!! Did anyone of you guys are actually using dynamic buffers and are making them work flawlessly? I mean, I get individual effect running correctly (all the c++ code is absolutly bugless) but mixing indexed and non indexed rendering with dynamic buffer is simply not possible. I get mad at times... The freaking debugger tells me that my arrays and buffers are correct but the freakin directx render only the last primitive! It the third time a ask about dynamic buffer in this forum and no one reply anything... only reply given in this directx forum is about stupid DrawIndexedPrimitiveUP or freakin multitexturing... Comme on is there anybody that work on somethin a little more serious than a 3d version of pong??? I need a real awnser comming out the head of someone who as one!
Sorry but I''m always felling the way my program does... this time its real bad !!
At least I got one... ! I want somebody to tell me that he is actually using dynamic buffers and he remarqued something tricky that anyone who is using it should be aware of... like do we discard buffer after each shader switch... or something like that... I read 2000 times the documentation and did what I think they say and its not working.. so I ask and ask again... Do anyone is capable of using dynamic buffers flawlessly?
Checking your profile, I see one message about dynamic buffers in the last six months. Please don''t get upset because somebody doesn''t answer - sometimes people can''t tell from the code you provide, you''re not explicit enough, or somebody just doesn''t have the time/knowledge.
Going back to your original post:
* Never assume a value of 32 bytes (for the vertex size). Use sizeof(...) on your vertex structure. Compilers can do funny things sometimes to your structures.
* If you render enough vertices, get rid of the position tracking in the buffer and just dump the buffer each time.
* Count * 32 in the lock means you are locking # vertices * 32 (so if you are trying to locking 10 vertices, you are actually locking 320). Did you intend to do this?
* Are your lock flags Discard and Append? If so, those are non-standard and may be macros to something else. Check the values of those flags.
* Check your primitive count - it says you are drawing 20 polygons - is that correct?
* What''s your call to DrawIndexedPrimitive look like?
* Are you clearing the vertex source after rendering? Same with textures?
If all else fails, you might want to ftp your code somewhere and see if some kind soul can look at it.
Jim Adams
Going back to your original post:
* Never assume a value of 32 bytes (for the vertex size). Use sizeof(...) on your vertex structure. Compilers can do funny things sometimes to your structures.
* If you render enough vertices, get rid of the position tracking in the buffer and just dump the buffer each time.
* Count * 32 in the lock means you are locking # vertices * 32 (so if you are trying to locking 10 vertices, you are actually locking 320). Did you intend to do this?
* Are your lock flags Discard and Append? If so, those are non-standard and may be macros to something else. Check the values of those flags.
* Check your primitive count - it says you are drawing 20 polygons - is that correct?
* What''s your call to DrawIndexedPrimitive look like?
* Are you clearing the vertex source after rendering? Same with textures?
If all else fails, you might want to ftp your code somewhere and see if some kind soul can look at it.
Jim Adams
Oups the moderator... I should moderate my words...
------
struct OXDynamicVertex
{ float VertexData[8];
}
c/c++ standard -> float = 4bytes -> 4bytes * 8 = 32bytes
packing struct by dword, 32bytes fit into dword adress
------
Second parameter of IDirect3DVertexBuffer8::Lock is sizeToLock not vertexCountToLock... so if I want 10 vertex I need to insert 320 bytes... no?
------
Buffers created with D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY
Discard = D3DLOCK_DISCARD|D3DLOCK_NOSYSLOCK
Append = D3DLOCK_NOOVERWRITE|D3DLOCK_NOSYSLOCK
------
refer to this therad for detail about how I set the OXrenderInfo structure before rendering...
<br>http://www.gamedev.net/community/forums/topic.asp?topic_id=105643<br>
------
quote:
* Never assume a value of 32 bytes (for the vertex size). Use sizeof(...) on your vertex structure. Compilers can do funny things sometimes to your structures.
struct OXDynamicVertex
{ float VertexData[8];
}
c/c++ standard -> float = 4bytes -> 4bytes * 8 = 32bytes
packing struct by dword, 32bytes fit into dword adress
------
quote:
Count * 32 in the lock means you are locking # vertices * 32 (so if you are trying to locking 10 vertices, you are actually locking 320). Did you intend to do this?
Second parameter of IDirect3DVertexBuffer8::Lock is sizeToLock not vertexCountToLock... so if I want 10 vertex I need to insert 320 bytes... no?
------
quote:
Are your lock flags Discard and Append? If so, those are non-standard and may be macros to something else. Check the values of those flags.
Buffers created with D3DUSAGE_DYNAMIC|D3DUSAGE_WRITEONLY
Discard = D3DLOCK_DISCARD|D3DLOCK_NOSYSLOCK
Append = D3DLOCK_NOOVERWRITE|D3DLOCK_NOSYSLOCK
------
quote:
What''s your call to DrawIndexedPrimitive look like?
OXRenderInfo::Render (void){ if (indexed) dev->DrawIndexedPrimitive (PrimitiveType, MinIndex, NumVertices, StartIndex, PrimitiveCount); else dev->DrawPrimitive (PrimitiveType, StartVertex, PrimitiveCount);}
refer to this therad for detail about how I set the OXrenderInfo structure before rendering...
<br>http://www.gamedev.net/community/forums/topic.asp?topic_id=105643<br>
quote:
Comme on is there anybody that work on somethin a little more serious than a 3d version of pong???
John Carmack and rest of us...
quote:
only reply given in this directx forum is about stupid DrawIndexedPrimitiveUP
DrawIndexedPrimitiveUP...did you try it? try it, might solve your troubles temporarily...
Also can you explain why you have float[32] in your vertex structure...?
Also do you have your index buffer filled correctly?... i mean are you taking care of the vertex index offset whiled appending of vertices...?
set BaseVertexIndex to 0, if you are rendering the entire VB from start and your index values in the IB are correctly set.
seems to me that you''re using 32-bit ibs. if that''s the case, you should definitely try 16-bit ones first, especially if your hardware has 0xffff for the maxindices caps.
they are easy if you spend some time reading the docs and available code samples. there are a couple of classes at developer.nvidia.com that show how to properly use static/dynamic vertex/index buffers, take a look at them.
yes, i''m using dynamic index and vertex buffers for my md3 rendering, and they work flawlessly.
never assume your code is correct. read the docs, read the samples, compare your code to sample code, put your data in the samples and sample code into your app, etc. etc. nobody said debugging was easy, get used to it.
i hate to tell you this, but i really can''t read others'' code, especially if it''s not formatted nicely and doesn''t have comments. you are asking someone to look at a piece of code from your program, guess what it does, guess what''s wrong with it, and tell you that information. now for someone that may be very obvious, and in those cases you usually get a fast reply, but for others it''s not obvious at all. and in those cases people don''t bother to debug your code because they have their own code to debug. this is the sad truth, unfortunately.
some bugs take long time to fix, accept this and get back to the debugger.
and if you are really clueless as to why the problem occurs, simplify your code to the point where you can compare it with sdk sample code and do a line-by-line comparisons, also exchange code and data as i said above.
---
Come to #directxdev IRC channel on AfterNET
quote:Original post by Shnoutz
Dynamic buffer, dynamic buffer, dynamic buffer... Such a pain in the ass!!!
they are easy if you spend some time reading the docs and available code samples. there are a couple of classes at developer.nvidia.com that show how to properly use static/dynamic vertex/index buffers, take a look at them.
quote:
Did anyone of you guys are actually using dynamic buffers and are making them work flawlessly?
yes, i''m using dynamic index and vertex buffers for my md3 rendering, and they work flawlessly.
quote:
yadda yadda
never assume your code is correct. read the docs, read the samples, compare your code to sample code, put your data in the samples and sample code into your app, etc. etc. nobody said debugging was easy, get used to it.
quote:
I need a real awnser comming out the head of someone who as one!
i hate to tell you this, but i really can''t read others'' code, especially if it''s not formatted nicely and doesn''t have comments. you are asking someone to look at a piece of code from your program, guess what it does, guess what''s wrong with it, and tell you that information. now for someone that may be very obvious, and in those cases you usually get a fast reply, but for others it''s not obvious at all. and in those cases people don''t bother to debug your code because they have their own code to debug. this is the sad truth, unfortunately.
quote:
Sorry but I''m always felling the way my program does... this time its real bad !!
some bugs take long time to fix, accept this and get back to the debugger.
and if you are really clueless as to why the problem occurs, simplify your code to the point where you can compare it with sdk sample code and do a line-by-line comparisons, also exchange code and data as i said above.
---
Come to #directxdev IRC channel on AfterNET
quote:
Second parameter of IDirect3DVertexBuffer8::Lock is sizeToLock not vertexCountToLock... so if I want 10 vertex I need to insert 320 bytes... no?
You''re write - that''s what I get for responding at 1:30 in the morning
quote:
struct OXDynamicVertex
{ float VertexData[8];
}
c/c++ standard -> float = 4bytes -> 4bytes * 8 = 32bytes
packing struct by dword, 32bytes fit into dword adress
I mentioned it, as hardcoding values is a bad thing. Say you add something to the structure later on - you''ll have to search for every instance of the 32 instead of just using sizeof.
As niyaw says, you might want to make sure you aren''t using 32-but indices. Also, set the base index to 0 if you are specifying a start index in the call to DrawIndexedPrimitive (also increase the number of accessed vertices by start+# indices used).
362-3865
quote:
Second parameter of IDirect3DVertexBuffer8::Lock is sizeToLock not vertexCountToLock... so if I want 10 vertex I need to insert 320 bytes... no?
You''re write - that''s what I get for responding at 1:30 in the morning
quote:
struct OXDynamicVertex
{ float VertexData[8];
}
c/c++ standard -> float = 4bytes -> 4bytes * 8 = 32bytes
packing struct by dword, 32bytes fit into dword adress
I mentioned it, as hardcoding values is a bad thing. Say you add something to the structure later on - you''ll have to search for every instance of the 32 instead of just using sizeof.
As niyaw says, you might want to make sure you aren''t using 32-but indices. Also, set the base index to 0 if you are specifying a start index in the call to DrawIndexedPrimitive (also increase the number of accessed vertices by start+# indices used).
I don`t see what you mean:
nVidia as a dynamic index buffer class using 32-bits indices... Also, why should I set BaseVertexIndex to 0 if i''m not adressing vertices from 0? I tried using the nvidia dynamic buffers classes and it give me the same result... Wich are : the first effect is working with dynamic vertex and index but the other effects are not working probably because of the cursors in the buffers that are not equal to zero anymore...
quote:
As niyaw says, you might want to make sure you aren''t using 32-bit indices. Also, set the base index to 0 if you are specifying a start index in the call to DrawIndexedPrimitive (also increase the number of accessed vertices by start+# indices used).
nVidia as a dynamic index buffer class using 32-bits indices... Also, why should I set BaseVertexIndex to 0 if i''m not adressing vertices from 0? I tried using the nvidia dynamic buffers classes and it give me the same result... Wich are : the first effect is working with dynamic vertex and index but the other effects are not working probably because of the cursors in the buffers that are not equal to zero anymore...
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement