Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Probelm using Dynamic Vertex Buffer.


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 Paulop   Members   -  Reputation: 114

Like
0Likes
Like

Posted 26 May 2012 - 01:18 PM

Hello,

I've got a problem using a circular dynamic vertex buffer for drawing basic primitives with a no-overwrite/discard pattern.
I'm trying to draw 500+ rectangles using D3DPT_LINESTRIP. Everything seems good but i've got flickering on the screen.
Before the 500th rectangle the last rectangle is draw in top left, after the 500th rectangle few or all of the next rectangles flick and appears some times in place or in top left of the screen.
I've tried to sleep the application for 16 ms, and everything looks fine, using DrawPrimitiveUP or forcing Discard work well too.

I've tried multiple Vertex Buffer Size but it's happening for every size. But with a smallest VB, i have just one rectangle going in top left

Do you have an idea of what happen and how to fix it ?

Sorry for my not so perfect english, it's not my native language. Posted Image

Thanks

Here is a sample code :

   int dataSize = Vertices.size() * sizeof( Vertex );
   BufferFlag::Enum bufferFlag = BufferFlag::NoOverwrite;
   if ( ForceDiscardVB || ( PositionInBuffer + Vertices.size() > VertexBufferSize ) )
   {
	bufferFlag = BufferFlag::Discard;
	PositionInBuffer = 0;
	ForceDiscardVB = false;
   }
   SetVertexBufferData ( *pVertexBuffer , &Vertices[0] , dataSize , bufferFlag , PositionInBuffer * sizeof ( Vertex ) );

   // Draw
   DrawPrimitives ( PrimitiveType , PositionInBuffer , (unsigned int) ( Vertices.size() * PrimitiveNumberCoeff ) );

   // Increment the buffer offset
   PositionInBuffer += Vertices.size();

Edited by Paulop, 26 May 2012 - 02:20 PM.


Sponsor:

#2 Paulop   Members   -  Reputation: 114

Like
2Likes
Like

Posted 26 May 2012 - 02:27 PM

I found the problem, i was not reinitialising my variables in Begin() and I was not using Discard for the first Lock of each frame.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS