Commit fd6ab600 authored by Maciej Suminski's avatar Maciej Suminski
Browse files

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
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -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;


+1 −2
Original line number Original line Diff line number Diff line
@@ -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 )
        return;
        return;
    }
    }


    bool isFirstPoint = true;
    LineCap savedLineCap = lineCap;
    LineCap savedLineCap = lineCap;
    bool isFirstLine = true;
    bool isFirstLine = true;
    VECTOR2D startEndVector;
    VECTOR2D startEndVector;
+6 −1
Original line number Original line Diff line number Diff line
@@ -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 )
        // 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 )


    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 );
+0 −1
Original line number Original line Diff line number Diff line
@@ -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;