Loading common/gal/opengl/opengl_gal.cpp +54 −36 Original line number Original line Diff line number Diff line Loading @@ -615,21 +615,36 @@ inline void OPENGL_GAL::drawLineQuad( const VECTOR2D& aStartPoint, const VECTOR2 VECTOR2D perpendicularVector( -startEndVector.y * scale, startEndVector.x * scale ); VECTOR2D perpendicularVector( -startEndVector.y * scale, startEndVector.x * scale ); // Compute the edge points of the line // Compute the edge points of the line VECTOR2D point1 = aStartPoint + perpendicularVector; VECTOR2D v0 = aStartPoint + perpendicularVector; VECTOR2D point2 = aStartPoint - perpendicularVector; VECTOR2D v1 = aStartPoint - perpendicularVector; VECTOR2D point3 = aEndPoint + perpendicularVector; VECTOR2D v2 = aEndPoint + perpendicularVector; VECTOR2D point4 = aEndPoint - perpendicularVector; VECTOR2D v3 = aEndPoint - perpendicularVector; if( isGrouping ) { 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, v3.x, v3.y, layerDepth, strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a, v0.x, v0.y, layerDepth, strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a, v3.x, v3.y, layerDepth, strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a, v2.x, v2.y, layerDepth, strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a }; curVboItem->PushVertices( newVertices, 6 ); } else { glBegin( GL_TRIANGLES ); glBegin( GL_TRIANGLES ); glVertex3d( point1.x, point1.y, layerDepth ); glVertex3d( v0.x, v0.y, layerDepth ); glVertex3d( point2.x, point2.y, layerDepth ); glVertex3d( v1.x, v1.y, layerDepth ); glVertex3d( point4.x, point4.y, layerDepth ); glVertex3d( v3.x, v3.y, layerDepth ); glVertex3d( point1.x, point1.y, layerDepth ); glVertex3d( v0.x, v0.y, layerDepth ); glVertex3d( point4.x, point4.y, layerDepth ); glVertex3d( v3.x, v3.y, layerDepth ); glVertex3d( point3.x, point3.y, layerDepth ); glVertex3d( v2.x, v2.y, layerDepth ); glEnd(); glEnd(); } } } void OPENGL_GAL::DrawSegment( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint, double aWidth ) void OPENGL_GAL::DrawSegment( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint, double aWidth ) Loading @@ -637,7 +652,7 @@ void OPENGL_GAL::DrawSegment( const VECTOR2D& aStartPoint, const VECTOR2D& aEndP VECTOR2D startEndVector = aEndPoint - aStartPoint; VECTOR2D startEndVector = aEndPoint - aStartPoint; double lineAngle = atan2( startEndVector.y, startEndVector.x ); double lineAngle = atan2( startEndVector.y, startEndVector.x ); if ( isGrouping ) /*if ( isGrouping ) { { // Angle of a line perpendicular to the segment being drawn // Angle of a line perpendicular to the segment being drawn double beta = ( M_PI / 2.0 ) - lineAngle; double beta = ( M_PI / 2.0 ) - lineAngle; Loading @@ -662,9 +677,11 @@ void OPENGL_GAL::DrawSegment( const VECTOR2D& aStartPoint, const VECTOR2D& aEndP }; }; curVboItem->PushVertices( newVertices, 6 ); curVboItem->PushVertices( newVertices, 6 ); } } else*/ { if( isFillEnabled ) if( isFillEnabled ) { { if( !isGrouping ) glColor4d( fillColor.r, fillColor.g, fillColor.b, fillColor.a ); glColor4d( fillColor.r, fillColor.g, fillColor.b, fillColor.a ); SetLineWidth( aWidth ); SetLineWidth( aWidth ); Loading Loading @@ -695,6 +712,7 @@ void OPENGL_GAL::DrawSegment( const VECTOR2D& aStartPoint, const VECTOR2D& aEndP glPopMatrix(); glPopMatrix(); } } } } } inline void OPENGL_GAL::drawLineCap( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint, inline void OPENGL_GAL::drawLineCap( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint, Loading common/gal/opengl/vbo_item.cpp +4 −4 Original line number Original line Diff line number Diff line Loading @@ -86,7 +86,7 @@ void VBO_ITEM::PushVertex( const GLfloat* aVertex ) } } void VBO_ITEM::PushVertices( const GLfloat* aVertex, GLuint aSize ) void VBO_ITEM::PushVertices( const GLfloat* aVertices, GLuint aSize ) { { int newSize = m_size + aSize; int newSize = m_size + aSize; GLfloat* newVertices = new GLfloat[newSize * VertStride]; GLfloat* newVertices = new GLfloat[newSize * VertStride]; Loading @@ -101,8 +101,8 @@ void VBO_ITEM::PushVertices( const GLfloat* aVertex, GLuint aSize ) } } m_vertices = newVertices; m_vertices = newVertices; // Add the new vertex // Add new vertices memcpy( &newVertices[m_size * VertStride], aVertex, aSize * VertSize ); memcpy( &newVertices[m_size * VertStride], aVertices, aSize * VertSize ); // Handle new indices // Handle new indices if( m_indices ) if( m_indices ) Loading Loading @@ -160,7 +160,7 @@ void SetVbo( int aVboId ) } } int GetVbo() int GetVbo() const { { } } */ */ include/gal/opengl/vbo_item.h +24 −10 Original line number Original line Diff line number Diff line Loading @@ -43,9 +43,23 @@ public: VBO_ITEM(); VBO_ITEM(); ~VBO_ITEM(); ~VBO_ITEM(); // TODO comments /** * Function PushVertex() * Adds a single vertex to the VBO_ITEM. Vertex contains information about coordinates and * colors and has to follow the specified format {X,Y,Z,R,G,B,A}. * @param aVertex is a vertex to be added. */ void PushVertex( const GLfloat* aVertex ); void PushVertex( const GLfloat* aVertex ); void PushVertices( const GLfloat* aVertex, GLuint aSize ); /** * Function PushVertices() * Adds multiple vertices to the VBO_ITEM. This function is recommended over multiple calls to * PushVertex, as it does less memory reallocations. Vertices contain information about * coordinates and colors and has to follow the specified format {X,Y,Z,R,G,B,A}. * @param aVertices are vertices to be added. * @param aSize is an amount of vertices to be added. */ void PushVertices( const GLfloat* aVertices, GLuint aSize ); /** /** * Function GetVertices() * Function GetVertices() Loading Loading @@ -79,7 +93,7 @@ public: ///< Functions for getting VBO ids. ///< Functions for getting VBO ids. //void SetVbo( int aVboId ); //void SetVbo( int aVboId ); //int GetVbo(); //int GetVbo() const; ///< Data organization information for vertices. ///< Data organization information for vertices. static const int VertStride = 7; static const int VertStride = 7; Loading common/gal/opengl/shader/round.vert +1 −1 File changed.Contains only whitespace changes. Show changes Loading
common/gal/opengl/opengl_gal.cpp +54 −36 Original line number Original line Diff line number Diff line Loading @@ -615,21 +615,36 @@ inline void OPENGL_GAL::drawLineQuad( const VECTOR2D& aStartPoint, const VECTOR2 VECTOR2D perpendicularVector( -startEndVector.y * scale, startEndVector.x * scale ); VECTOR2D perpendicularVector( -startEndVector.y * scale, startEndVector.x * scale ); // Compute the edge points of the line // Compute the edge points of the line VECTOR2D point1 = aStartPoint + perpendicularVector; VECTOR2D v0 = aStartPoint + perpendicularVector; VECTOR2D point2 = aStartPoint - perpendicularVector; VECTOR2D v1 = aStartPoint - perpendicularVector; VECTOR2D point3 = aEndPoint + perpendicularVector; VECTOR2D v2 = aEndPoint + perpendicularVector; VECTOR2D point4 = aEndPoint - perpendicularVector; VECTOR2D v3 = aEndPoint - perpendicularVector; if( isGrouping ) { 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, v3.x, v3.y, layerDepth, strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a, v0.x, v0.y, layerDepth, strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a, v3.x, v3.y, layerDepth, strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a, v2.x, v2.y, layerDepth, strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a }; curVboItem->PushVertices( newVertices, 6 ); } else { glBegin( GL_TRIANGLES ); glBegin( GL_TRIANGLES ); glVertex3d( point1.x, point1.y, layerDepth ); glVertex3d( v0.x, v0.y, layerDepth ); glVertex3d( point2.x, point2.y, layerDepth ); glVertex3d( v1.x, v1.y, layerDepth ); glVertex3d( point4.x, point4.y, layerDepth ); glVertex3d( v3.x, v3.y, layerDepth ); glVertex3d( point1.x, point1.y, layerDepth ); glVertex3d( v0.x, v0.y, layerDepth ); glVertex3d( point4.x, point4.y, layerDepth ); glVertex3d( v3.x, v3.y, layerDepth ); glVertex3d( point3.x, point3.y, layerDepth ); glVertex3d( v2.x, v2.y, layerDepth ); glEnd(); glEnd(); } } } void OPENGL_GAL::DrawSegment( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint, double aWidth ) void OPENGL_GAL::DrawSegment( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint, double aWidth ) Loading @@ -637,7 +652,7 @@ void OPENGL_GAL::DrawSegment( const VECTOR2D& aStartPoint, const VECTOR2D& aEndP VECTOR2D startEndVector = aEndPoint - aStartPoint; VECTOR2D startEndVector = aEndPoint - aStartPoint; double lineAngle = atan2( startEndVector.y, startEndVector.x ); double lineAngle = atan2( startEndVector.y, startEndVector.x ); if ( isGrouping ) /*if ( isGrouping ) { { // Angle of a line perpendicular to the segment being drawn // Angle of a line perpendicular to the segment being drawn double beta = ( M_PI / 2.0 ) - lineAngle; double beta = ( M_PI / 2.0 ) - lineAngle; Loading @@ -662,9 +677,11 @@ void OPENGL_GAL::DrawSegment( const VECTOR2D& aStartPoint, const VECTOR2D& aEndP }; }; curVboItem->PushVertices( newVertices, 6 ); curVboItem->PushVertices( newVertices, 6 ); } } else*/ { if( isFillEnabled ) if( isFillEnabled ) { { if( !isGrouping ) glColor4d( fillColor.r, fillColor.g, fillColor.b, fillColor.a ); glColor4d( fillColor.r, fillColor.g, fillColor.b, fillColor.a ); SetLineWidth( aWidth ); SetLineWidth( aWidth ); Loading Loading @@ -695,6 +712,7 @@ void OPENGL_GAL::DrawSegment( const VECTOR2D& aStartPoint, const VECTOR2D& aEndP glPopMatrix(); glPopMatrix(); } } } } } inline void OPENGL_GAL::drawLineCap( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint, inline void OPENGL_GAL::drawLineCap( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint, Loading
common/gal/opengl/vbo_item.cpp +4 −4 Original line number Original line Diff line number Diff line Loading @@ -86,7 +86,7 @@ void VBO_ITEM::PushVertex( const GLfloat* aVertex ) } } void VBO_ITEM::PushVertices( const GLfloat* aVertex, GLuint aSize ) void VBO_ITEM::PushVertices( const GLfloat* aVertices, GLuint aSize ) { { int newSize = m_size + aSize; int newSize = m_size + aSize; GLfloat* newVertices = new GLfloat[newSize * VertStride]; GLfloat* newVertices = new GLfloat[newSize * VertStride]; Loading @@ -101,8 +101,8 @@ void VBO_ITEM::PushVertices( const GLfloat* aVertex, GLuint aSize ) } } m_vertices = newVertices; m_vertices = newVertices; // Add the new vertex // Add new vertices memcpy( &newVertices[m_size * VertStride], aVertex, aSize * VertSize ); memcpy( &newVertices[m_size * VertStride], aVertices, aSize * VertSize ); // Handle new indices // Handle new indices if( m_indices ) if( m_indices ) Loading Loading @@ -160,7 +160,7 @@ void SetVbo( int aVboId ) } } int GetVbo() int GetVbo() const { { } } */ */
include/gal/opengl/vbo_item.h +24 −10 Original line number Original line Diff line number Diff line Loading @@ -43,9 +43,23 @@ public: VBO_ITEM(); VBO_ITEM(); ~VBO_ITEM(); ~VBO_ITEM(); // TODO comments /** * Function PushVertex() * Adds a single vertex to the VBO_ITEM. Vertex contains information about coordinates and * colors and has to follow the specified format {X,Y,Z,R,G,B,A}. * @param aVertex is a vertex to be added. */ void PushVertex( const GLfloat* aVertex ); void PushVertex( const GLfloat* aVertex ); void PushVertices( const GLfloat* aVertex, GLuint aSize ); /** * Function PushVertices() * Adds multiple vertices to the VBO_ITEM. This function is recommended over multiple calls to * PushVertex, as it does less memory reallocations. Vertices contain information about * coordinates and colors and has to follow the specified format {X,Y,Z,R,G,B,A}. * @param aVertices are vertices to be added. * @param aSize is an amount of vertices to be added. */ void PushVertices( const GLfloat* aVertices, GLuint aSize ); /** /** * Function GetVertices() * Function GetVertices() Loading Loading @@ -79,7 +93,7 @@ public: ///< Functions for getting VBO ids. ///< Functions for getting VBO ids. //void SetVbo( int aVboId ); //void SetVbo( int aVboId ); //int GetVbo(); //int GetVbo() const; ///< Data organization information for vertices. ///< Data organization information for vertices. static const int VertStride = 7; static const int VertStride = 7; Loading
common/gal/opengl/shader/round.vert +1 −1 File changed.Contains only whitespace changes. Show changes