From 3b3c674c1a72f515fae9ba7304aa9b393a57bd09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20W=C5=82ostowski?= Date: Tue, 19 Feb 2019 01:55:32 +0100 Subject: [PATCH] gal: opengl: use correct radius for graphical circles --- common/gal/opengl/gl_builtin_shaders.cpp | 9 ++++++--- include/gal/opengl/opengl_gal.h | 1 - 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/common/gal/opengl/gl_builtin_shaders.cpp b/common/gal/opengl/gl_builtin_shaders.cpp index f2d4ce85e5..21bd36e898 100644 --- a/common/gal/opengl/gl_builtin_shaders.cpp +++ b/common/gal/opengl/gl_builtin_shaders.cpp @@ -148,12 +148,15 @@ void computeLineCoords( bool posture, vec2 vs, vec2 vp, vec2 texcoord, vec2 dir, } -void computeCircleCoords( float vertexIndex, float radius, float lineWidth ) +void computeCircleCoords( float mode, float vertexIndex, float radius, float lineWidth ) { vec4 delta; vec4 center = roundv( gl_ModelViewProjectionMatrix * gl_Vertex + vec4(1, 1, 0, 0), screenPixelSize ); float pixelWidth = roundr( lineWidth / worldPixelSize, 1.0); - float pixelR = roundr( radius / worldPixelSize, 1.0); + float pixelR = roundr( radius / worldPixelSize, 1.0); + + if( mode == SHADER_STROKED_CIRCLE) + pixelR += pixelWidth / 2.0; vec4 adjust = vec4(-1, -1, 0, 0); @@ -227,7 +230,7 @@ void main() else if( mode == SHADER_LINE_F ) computeLineCoords( posture, -vs, vp, vec2( 1, 1 ), vec2( -1, 0 ), lineWidth, false ); else if( mode == SHADER_FILLED_CIRCLE || mode == SHADER_STROKED_CIRCLE) - computeCircleCoords( shaderParams.y, shaderParams.z, shaderParams.w ); + computeCircleCoords( mode, shaderParams.y, shaderParams.z, shaderParams.w ); else { // Pass through the coordinates like in the fixed pipeline diff --git a/include/gal/opengl/opengl_gal.h b/include/gal/opengl/opengl_gal.h index 732859f96c..322e157cba 100644 --- a/include/gal/opengl/opengl_gal.h +++ b/include/gal/opengl/opengl_gal.h @@ -322,7 +322,6 @@ private: GLint ufm_worldPixelSize; GLint ufm_screenPixelSize; GLint ufm_pixelSizeMultiplier; - GLint ufm_backingScaleFactor; std::unique_ptr bitmapCache;