diff --git a/common/gal/graphics_abstraction_layer.cpp b/common/gal/graphics_abstraction_layer.cpp index 51c5bd5786..f693507735 100644 --- a/common/gal/graphics_abstraction_layer.cpp +++ b/common/gal/graphics_abstraction_layer.cpp @@ -97,13 +97,12 @@ void GAL::DrawGrid() double width = gridLineWidth / worldScale; double doubleWidth = 2 * width; - // Set line width & color - SetLineWidth( width ); - - double origSize = (double) gridOriginMarkerSize / worldScale; + SetLayerDepth( 0.0 ); // Draw the origin marker + double origSize = (double) gridOriginMarkerSize / worldScale; SetStrokeColor( COLOR4D( 1.0, 1.0, 1.0, 1.0 ) ); + SetLineWidth( width ); SetIsFill( false ); DrawLine( gridOrigin + VECTOR2D( -origSize, -origSize ), gridOrigin + VECTOR2D( origSize, origSize ) ); DrawLine( gridOrigin + VECTOR2D( -origSize, origSize ), gridOrigin + VECTOR2D( origSize, -origSize ) ); diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp index 097c141077..462bf30f55 100644 --- a/common/gal/opengl/opengl_gal.cpp +++ b/common/gal/opengl/opengl_gal.cpp @@ -113,20 +113,18 @@ OPENGL_GAL::OPENGL_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener, InitTesselatorCallbacks( tesselator ); gluTessProperty( tesselator, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_POSITIVE ); - if( !isUseShader ) - { - // (3 vertices per triangle) * (2 items [circle&semicircle]) * (number of points per item) - precomputedContainer = new VBO_CONTAINER( 3 * 2 * CIRCLE_POINTS ); + // Buffered semicircle & circle vertices + // (3 vertices per triangle) * (2 items [circle&semicircle]) * (number of points per item) + precomputedContainer = new VBO_CONTAINER( 3 * 2 * CIRCLE_POINTS ); - // Compute the unit circles, used for speed up of the circle drawing - verticesCircle = new VBO_ITEM( precomputedContainer ); - computeUnitCircle(); - verticesCircle->Finish(); + // Compute the unit circles, used for speed up of the circle drawing + verticesCircle = new VBO_ITEM( precomputedContainer ); + computeUnitCircle(); + verticesCircle->Finish(); - verticesSemiCircle = new VBO_ITEM( precomputedContainer ); - computeUnitSemiCircle(); - verticesSemiCircle->Finish(); - } + verticesSemiCircle = new VBO_ITEM( precomputedContainer ); + computeUnitSemiCircle(); + verticesSemiCircle->Finish(); } @@ -134,12 +132,9 @@ OPENGL_GAL::~OPENGL_GAL() { glFlush(); - if( !isUseShader ) - { - delete verticesCircle; - delete verticesSemiCircle; - delete precomputedContainer; - } + delete verticesCircle; + delete verticesSemiCircle; + delete precomputedContainer; // Delete the buffers if( isFrameBufferInitialized ) @@ -449,8 +444,6 @@ void OPENGL_GAL::BeginDrawing() void OPENGL_GAL::blitMainTexture( bool aIsClearFrameBuffer ) { - shader.Deactivate(); - // Don't use blending for the final blitting glDisable( GL_BLEND ); @@ -606,7 +599,7 @@ inline void OPENGL_GAL::drawLineQuad( const VECTOR2D& aStartPoint, const VECTOR2 begin( GL_TRIANGLES ); - if( isUseShader ) + if( isUseShader && isGrouping ) { glm::vec4 vector( perpendicularVector.x, perpendicularVector.y, 0.0, 0.0 ); @@ -1026,7 +1019,7 @@ void OPENGL_GAL::DrawRectangle( const VECTOR2D& aStartPoint, const VECTOR2D& aEn void OPENGL_GAL::DrawCircle( const VECTOR2D& aCenterPoint, double aRadius ) { - if( isUseShader ) + if( isUseShader && isGrouping ) { if( isFillEnabled ) { @@ -1161,7 +1154,7 @@ void OPENGL_GAL::DrawCircle( const VECTOR2D& aCenterPoint, double aRadius ) void OPENGL_GAL::drawSemiCircle( const VECTOR2D& aCenterPoint, double aRadius, double aAngle ) { - if( isUseShader ) + if( isUseShader && isGrouping ) { Save(); Translate( aCenterPoint ); @@ -1924,9 +1917,6 @@ void OPENGL_GAL::DrawGridLine( const VECTOR2D& aStartPoint, const VECTOR2D& aEnd VECTOR2D point3 = aEndPoint + perpendicularVector; VECTOR2D point4 = aEndPoint - perpendicularVector; - if( isUseShader ) - shader.Deactivate(); - // Set color glColor4d( gridColor.r, gridColor.g, gridColor.b, gridColor.a ); diff --git a/include/gal/opengl/opengl_gal.h b/include/gal/opengl/opengl_gal.h index 0fc4b0a3cf..77acc3a1f8 100644 --- a/include/gal/opengl/opengl_gal.h +++ b/include/gal/opengl/opengl_gal.h @@ -409,7 +409,6 @@ private: bool isFrameBufferInitialized; ///< Are the frame buffers initialized? bool isVboInitialized; bool isShaderInitialized; ///< Was the shader initialized? - bool isShaderEnabled; ///< Are the shaders enabled? bool isUseShader; ///< Should the shaders be used? bool isGrouping; ///< Was a group started?