Loading common/gal/opengl/opengl_gal.cpp +10 −22 Original line number Diff line number Diff line Loading @@ -651,28 +651,16 @@ void OPENGL_GAL::DrawSegment( const VECTOR2D& aStartPoint, const VECTOR2D& aEndP VECTOR2D v3( aEndPoint.x - ( aWidth * cos( beta ) / 2.0 ), aEndPoint.y + ( aWidth * sin( beta ) / 2.0 ) ); // First triangle GLfloat newVertex1[] = { v0.x, v0.y, layerDepth, strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a }; GLfloat newVertex2[] = { v1.x, v1.y, layerDepth, strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a }; GLfloat newVertex3[] = { v2.x, v2.y, layerDepth, strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a }; // Second triangle GLfloat newVertex4[] = { v0.x, v0.y, layerDepth, strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a }; GLfloat newVertex5[] = { v2.x, v2.y, layerDepth, strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a }; GLfloat newVertex6[] = { v3.x, v3.y, layerDepth, strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a }; curVboItem->PushVertex( newVertex1 ); curVboItem->PushVertex( newVertex2 ); curVboItem->PushVertex( newVertex3 ); curVboItem->PushVertex( newVertex4 ); curVboItem->PushVertex( newVertex5 ); curVboItem->PushVertex( newVertex6 ); // Two triangles GLfloat newVertices[] = { v0.x, v0.y, layerDepth, strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a, v1.x, v1.y, layerDepth, strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a, v2.x, v2.y, layerDepth, strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a, v0.x, v0.y, layerDepth, strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a, v2.x, v2.y, layerDepth, strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a, v3.x, v3.y, layerDepth, strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a }; curVboItem->PushVertices( newVertices, 6 ); } if( isFillEnabled ) Loading common/gal/opengl/vbo_item.cpp +32 −3 Original line number Diff line number Diff line Loading @@ -61,7 +61,7 @@ void VBO_ITEM::PushVertex( const GLfloat* aVertex ) if( m_vertices ) { // Copy all previous vertices data memcpy( newVertices, m_vertices, ( m_size ) * VertSize ); memcpy( newVertices, m_vertices, m_size * VertSize ); delete m_vertices; } m_vertices = newVertices; Loading @@ -73,7 +73,7 @@ void VBO_ITEM::PushVertex( const GLfloat* aVertex ) if( m_indices ) { // Copy all previous vertices data memcpy( newIndices, m_indices, ( m_size ) * IndSize ); memcpy( newIndices, m_indices, m_size * IndSize ); delete m_indices; } m_indices = newIndices; Loading @@ -88,7 +88,36 @@ void VBO_ITEM::PushVertex( const GLfloat* aVertex ) void VBO_ITEM::PushVertices( const GLfloat* aVertex, GLuint aSize ) { // FIXME to be done int newSize = m_size + aSize; GLfloat* newVertices = new GLfloat[newSize * VertStride]; GLuint* newIndices = new GLuint[newSize * IndStride]; // Handle new vertices if( m_vertices ) { // Copy all previous vertices data memcpy( newVertices, m_vertices, ( m_size ) * VertSize ); delete m_vertices; } m_vertices = newVertices; // Add the new vertex memcpy( &newVertices[m_size * VertStride], aVertex, aSize * VertSize ); // Handle new indices if( m_indices ) { // Copy all previous vertices data memcpy( newIndices, m_indices, ( m_size ) * IndSize ); delete m_indices; } m_indices = newIndices; // Add the new vertex for( int i = m_size; i < newSize; ++i ) m_indices[i] = m_offset + i; m_size += aSize; m_isDirty = true; } Loading include/gal/opengl/vbo_item.h +1 −0 Original line number Diff line number Diff line Loading @@ -96,6 +96,7 @@ private: ///< Packed by 7 floats for each vertex: {X, Y, Z, R, G, B, A} GLfloat* m_vertices; ///< Indices of vertices GLuint* m_indices; ///< Offset and size of data in VBO. Loading Loading
common/gal/opengl/opengl_gal.cpp +10 −22 Original line number Diff line number Diff line Loading @@ -651,28 +651,16 @@ void OPENGL_GAL::DrawSegment( const VECTOR2D& aStartPoint, const VECTOR2D& aEndP VECTOR2D v3( aEndPoint.x - ( aWidth * cos( beta ) / 2.0 ), aEndPoint.y + ( aWidth * sin( beta ) / 2.0 ) ); // First triangle GLfloat newVertex1[] = { v0.x, v0.y, layerDepth, strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a }; GLfloat newVertex2[] = { v1.x, v1.y, layerDepth, strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a }; GLfloat newVertex3[] = { v2.x, v2.y, layerDepth, strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a }; // Second triangle GLfloat newVertex4[] = { v0.x, v0.y, layerDepth, strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a }; GLfloat newVertex5[] = { v2.x, v2.y, layerDepth, strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a }; GLfloat newVertex6[] = { v3.x, v3.y, layerDepth, strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a }; curVboItem->PushVertex( newVertex1 ); curVboItem->PushVertex( newVertex2 ); curVboItem->PushVertex( newVertex3 ); curVboItem->PushVertex( newVertex4 ); curVboItem->PushVertex( newVertex5 ); curVboItem->PushVertex( newVertex6 ); // Two triangles GLfloat newVertices[] = { v0.x, v0.y, layerDepth, strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a, v1.x, v1.y, layerDepth, strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a, v2.x, v2.y, layerDepth, strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a, v0.x, v0.y, layerDepth, strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a, v2.x, v2.y, layerDepth, strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a, v3.x, v3.y, layerDepth, strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a }; curVboItem->PushVertices( newVertices, 6 ); } if( isFillEnabled ) Loading
common/gal/opengl/vbo_item.cpp +32 −3 Original line number Diff line number Diff line Loading @@ -61,7 +61,7 @@ void VBO_ITEM::PushVertex( const GLfloat* aVertex ) if( m_vertices ) { // Copy all previous vertices data memcpy( newVertices, m_vertices, ( m_size ) * VertSize ); memcpy( newVertices, m_vertices, m_size * VertSize ); delete m_vertices; } m_vertices = newVertices; Loading @@ -73,7 +73,7 @@ void VBO_ITEM::PushVertex( const GLfloat* aVertex ) if( m_indices ) { // Copy all previous vertices data memcpy( newIndices, m_indices, ( m_size ) * IndSize ); memcpy( newIndices, m_indices, m_size * IndSize ); delete m_indices; } m_indices = newIndices; Loading @@ -88,7 +88,36 @@ void VBO_ITEM::PushVertex( const GLfloat* aVertex ) void VBO_ITEM::PushVertices( const GLfloat* aVertex, GLuint aSize ) { // FIXME to be done int newSize = m_size + aSize; GLfloat* newVertices = new GLfloat[newSize * VertStride]; GLuint* newIndices = new GLuint[newSize * IndStride]; // Handle new vertices if( m_vertices ) { // Copy all previous vertices data memcpy( newVertices, m_vertices, ( m_size ) * VertSize ); delete m_vertices; } m_vertices = newVertices; // Add the new vertex memcpy( &newVertices[m_size * VertStride], aVertex, aSize * VertSize ); // Handle new indices if( m_indices ) { // Copy all previous vertices data memcpy( newIndices, m_indices, ( m_size ) * IndSize ); delete m_indices; } m_indices = newIndices; // Add the new vertex for( int i = m_size; i < newSize; ++i ) m_indices[i] = m_offset + i; m_size += aSize; m_isDirty = true; } Loading
include/gal/opengl/vbo_item.h +1 −0 Original line number Diff line number Diff line Loading @@ -96,6 +96,7 @@ private: ///< Packed by 7 floats for each vertex: {X, Y, Z, R, G, B, A} GLfloat* m_vertices; ///< Indices of vertices GLuint* m_indices; ///< Offset and size of data in VBO. Loading