From f82f310dd52e56d14ef7c28a2a0f41f1fdd944f4 Mon Sep 17 00:00:00 2001 From: Tomasz Wlostowski Date: Fri, 3 Aug 2018 11:05:33 +0200 Subject: [PATCH] eeschema-gal: added EnableDepthTest() feature in GAL --- common/gal/cairo/cairo_gal.cpp | 5 +++++ common/gal/opengl/opengl_gal.cpp | 10 ++++++++++ include/gal/cairo/cairo_gal.h | 2 ++ include/gal/graphics_abstraction_layer.h | 2 ++ include/gal/opengl/opengl_gal.h | 2 ++ 5 files changed, 21 insertions(+) diff --git a/common/gal/cairo/cairo_gal.cpp b/common/gal/cairo/cairo_gal.cpp index 53593c3cc9..b5f3e4f67e 100644 --- a/common/gal/cairo/cairo_gal.cpp +++ b/common/gal/cairo/cairo_gal.cpp @@ -1199,3 +1199,8 @@ unsigned int CAIRO_GAL::getNewGroupNumber() return groupCounter++; } + +void CAIRO_GAL::EnableDepthTest( bool aEnabled ) +{ + +} diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp index 8ceeb0e6a1..80d9aeab73 100644 --- a/common/gal/opengl/opengl_gal.cpp +++ b/common/gal/opengl/opengl_gal.cpp @@ -2065,3 +2065,13 @@ static void InitTesselatorCallbacks( GLUtesselator* aTesselator ) gluTessCallback( aTesselator, GLU_TESS_EDGE_FLAG, ( void (CALLBACK*)() )EdgeCallback ); gluTessCallback( aTesselator, GLU_TESS_ERROR, ( void (CALLBACK*)() )ErrorCallback ); } + +void OPENGL_GAL::EnableDepthTest( bool aEnabled ) +{ + if( aEnabled ) + glEnable( GL_DEPTH_TEST ); + else + { + glDisable( GL_DEPTH_TEST ); + } +} diff --git a/include/gal/cairo/cairo_gal.h b/include/gal/cairo/cairo_gal.h index bd4e63a9b1..7d7cd43878 100644 --- a/include/gal/cairo/cairo_gal.h +++ b/include/gal/cairo/cairo_gal.h @@ -278,6 +278,8 @@ public: paintListener = aPaintListener; } + virtual void EnableDepthTest( bool aEnabled = false ) override; + protected: virtual void drawGridLine( const VECTOR2D& aStartPoint, const VECTOR2D& aEndPoint ) override; diff --git a/include/gal/graphics_abstraction_layer.h b/include/gal/graphics_abstraction_layer.h index 1cca778d10..b68c49a5a8 100644 --- a/include/gal/graphics_abstraction_layer.h +++ b/include/gal/graphics_abstraction_layer.h @@ -988,6 +988,8 @@ public: depthStack.pop(); } + virtual void EnableDepthTest( bool aEnabled = false ) {}; + static const double METRIC_UNIT_LENGTH; protected: diff --git a/include/gal/opengl/opengl_gal.h b/include/gal/opengl/opengl_gal.h index b5011dd893..96428b52e6 100644 --- a/include/gal/opengl/opengl_gal.h +++ b/include/gal/opengl/opengl_gal.h @@ -276,6 +276,8 @@ public: paintListener = aPaintListener; } + virtual void EnableDepthTest( bool aEnabled = false ) override; + ///< Parameters passed to the GLU tesselator typedef struct {