summaryrefslogtreecommitdiff
path: root/chart2/opengl
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-02-03 18:06:20 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-02-03 18:28:04 +0100
commit27c1d4f2c4f55b67499d73fa7452a9a14a2aa948 (patch)
treed51bae39b3a2bdcdd01de4e943cd332a53a6399c /chart2/opengl
parentb13185adbab4c18dbd691cf78083545b2874f2e8 (diff)
working symbol rendering based on point sprites
This approach ahs several advantages compared to the old approach. There is no UNO involved anymore and we have a perfect shape defined by a mathematical formula. No need for anti-aliasing or complex calculations on the CPU. Change-Id: I5018eae516de3368037c4c293d937de66f38568d
Diffstat (limited to 'chart2/opengl')
-rw-r--r--chart2/opengl/symbolFragmentShader.glsl61
-rw-r--r--chart2/opengl/symbolVertexShader.glsl3
2 files changed, 58 insertions, 6 deletions
diff --git a/chart2/opengl/symbolFragmentShader.glsl b/chart2/opengl/symbolFragmentShader.glsl
index a84d83cfba48..2837f958af29 100644
--- a/chart2/opengl/symbolFragmentShader.glsl
+++ b/chart2/opengl/symbolFragmentShader.glsl
@@ -6,17 +6,70 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
-#
+
#version 120
varying vec4 fragmentColor;
+uniform int shape;
void main()
{
vec2 p = gl_PointCoord * 2.0 - vec2(1.0); // (0,0) in the center
- if (abs(p.x) < abs(p.y))
- discard;
-
+ if(shape == 0)
+ {
+ }
+ else if(shape == 1) //diamon
+ {
+ if (abs(p.x) + abs(p.y) > 1)
+ discard;
+ }
+ else if(shape == 2) // arrow
+ {
+ if(p.y < 0 && (abs(p.x) + abs(p.y)) > 1)
+ discard;
+ else if(p.y > 0 && abs(p.x) > 0.5)
+ discard;
+ }
+ else if(shape == 3) //arrow up
+ {
+ if(p.y > 0 && (abs(p.x) + abs(p.y)) > 1)
+ discard;
+ else if(p.y < 0 && abs(p.x) > 0.5)
+ discard;
+ }
+ else if(shape == 4)
+ {
+ if(p.x > 0 && (abs(p.x) + abs(p.y)) > 1)
+ discard;
+ else if(p.x < 0 && abs(p.y) > 0.5)
+ discard;
+ }
+ else if(shape == 5)
+ {
+ if(p.x < 0 && (abs(p.x) + abs(p.y)) > 1)
+ discard;
+ else if(p.x > 0 && abs(p.y) > 0.5)
+ discard;
+ }
+ else if(shape == 6)
+ {
+ if(abs(p.x) < abs(p.y))
+ discard;
+ }
+ else if(shape == 7)
+ {
+ if(abs(p.y) < abs(p.x))
+ discard;
+ }
+ else if(shape == 8)
+ {
+ if(dot(p.x, p.y) > 1)
+ discard;
+ }
+ else if(shape == 9)
+ {
+ }
+
gl_FragColor = fragmentColor;
}
diff --git a/chart2/opengl/symbolVertexShader.glsl b/chart2/opengl/symbolVertexShader.glsl
index e1bbec9bc202..3cf9f41ef21b 100644
--- a/chart2/opengl/symbolVertexShader.glsl
+++ b/chart2/opengl/symbolVertexShader.glsl
@@ -16,9 +16,8 @@ varying vec4 fragmentColor;
void main()
{
- gl_Position = MVP * vec4(vPosition, 1);
+ gl_Position = MVP * vec4(vPosition, 1);
fragmentColor = vColor;
- gl_PointSize = 10.0;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */