Commit fd6ab600 authored by Maciej Suminski's avatar Maciej Suminski

Bug fixes:

- VBO_CONTAINER::allocate() was returning wrong value in case of error
- framelimiter had wrong formula for computing destined period between frames
- removed _padding field from VBO_VERTEX, as it was not speeding up, but wasting memory
parent 929a849b
...@@ -127,7 +127,7 @@ void EDA_DRAW_PANEL_GAL::Refresh( bool eraseBackground, const wxRect* rect ) ...@@ -127,7 +127,7 @@ void EDA_DRAW_PANEL_GAL::Refresh( bool eraseBackground, const wxRect* rect )
// Framerate limiter // Framerate limiter
wxLongLong currentTimeStamp = wxGetLocalTimeMillis(); wxLongLong currentTimeStamp = wxGetLocalTimeMillis();
if( currentTimeStamp - m_timeStamp < ( 1 / FPS_LIMIT ) ) if( currentTimeStamp - m_timeStamp < ( 1000 / FPS_LIMIT ) )
return; return;
m_timeStamp = currentTimeStamp; m_timeStamp = currentTimeStamp;
......
...@@ -755,8 +755,6 @@ void OPENGL_GAL::DrawLine( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoin ...@@ -755,8 +755,6 @@ void OPENGL_GAL::DrawLine( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoin
void OPENGL_GAL::DrawPolyline( std::deque<VECTOR2D>& aPointList ) void OPENGL_GAL::DrawPolyline( std::deque<VECTOR2D>& aPointList )
{ {
bool isFirstPoint = true;
if( isUseShader ) if( isUseShader )
{ {
// This method reduces amount of triangles used for drawing // This method reduces amount of triangles used for drawing
...@@ -771,6 +769,7 @@ void OPENGL_GAL::DrawPolyline( std::deque<VECTOR2D>& aPointList ) ...@@ -771,6 +769,7 @@ void OPENGL_GAL::DrawPolyline( std::deque<VECTOR2D>& aPointList )
return; return;
} }
bool isFirstPoint = true;
LineCap savedLineCap = lineCap; LineCap savedLineCap = lineCap;
bool isFirstLine = true; bool isFirstLine = true;
VECTOR2D startEndVector; VECTOR2D startEndVector;
......
...@@ -225,8 +225,10 @@ unsigned int VBO_CONTAINER::allocate( VBO_ITEM* aVboItem, unsigned int aSize ) ...@@ -225,8 +225,10 @@ unsigned int VBO_CONTAINER::allocate( VBO_ITEM* aVboItem, unsigned int aSize )
// An error has occurred // An error has occurred
if( !result ) if( !result )
{
return UINT_MAX; return UINT_MAX;
} }
}
// Look for the space with at least given size // Look for the space with at least given size
FreeChunkMap::iterator it = m_freeChunks.lower_bound( aSize ); FreeChunkMap::iterator it = m_freeChunks.lower_bound( aSize );
...@@ -236,7 +238,9 @@ unsigned int VBO_CONTAINER::allocate( VBO_ITEM* aVboItem, unsigned int aSize ) ...@@ -236,7 +238,9 @@ unsigned int VBO_CONTAINER::allocate( VBO_ITEM* aVboItem, unsigned int aSize )
// This means that there is enough space for // This means that there is enough space for
// storing vertices, but the space is not continous // storing vertices, but the space is not continous
if( !defragment() ) if( !defragment() )
return false; {
return UINT_MAX;
}
// We can take the first free chunk, as there is only one after defragmentation // We can take the first free chunk, as there is only one after defragmentation
// and we can be sure that it provides enough space to store the object // and we can be sure that it provides enough space to store the object
...@@ -245,6 +249,7 @@ unsigned int VBO_CONTAINER::allocate( VBO_ITEM* aVboItem, unsigned int aSize ) ...@@ -245,6 +249,7 @@ unsigned int VBO_CONTAINER::allocate( VBO_ITEM* aVboItem, unsigned int aSize )
unsigned int chunkSize = it->first; unsigned int chunkSize = it->first;
unsigned int chunkOffset = it->second; unsigned int chunkOffset = it->second;
m_freeChunks.erase( it ); m_freeChunks.erase( it );
wxASSERT( chunkSize >= aSize ); wxASSERT( chunkSize >= aSize );
......
...@@ -41,7 +41,6 @@ typedef struct VBO_VERTEX ...@@ -41,7 +41,6 @@ typedef struct VBO_VERTEX
GLfloat x, y, z; // Coordinates GLfloat x, y, z; // Coordinates
GLfloat r, g, b, a; // Color GLfloat r, g, b, a; // Color
GLfloat shader[4]; // Shader type & params GLfloat shader[4]; // Shader type & params
GLfloat _padding;
} VBO_VERTEX; } VBO_VERTEX;
class VBO_CONTAINER; class VBO_CONTAINER;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment