summaryrefslogtreecommitdiff
path: root/chart2/opengl
diff options
context:
space:
mode:
authorweigao <weigao@multicorewareinc.com>2014-08-03 18:55:54 +0800
committerMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-08-06 20:45:13 +0200
commite3d4a488a0c3eab68d4c77139f8d9b203e1ddafc (patch)
tree5566a8db574c99e0b5b7a1db6376314322d0ce86 /chart2/opengl
parent495d53b1dc0f3c32e0b76344775b9fc728e09fe5 (diff)
make GL 3.0 support bars scroll
Change-Id: I71d8d94f410e6c67d0e188ea2e0f79eb151758e0
Diffstat (limited to 'chart2/opengl')
-rw-r--r--chart2/opengl/shape3DFragmentShaderV300.glsl4
-rw-r--r--chart2/opengl/shape3DVertexShaderV300.glsl8
2 files changed, 10 insertions, 2 deletions
diff --git a/chart2/opengl/shape3DFragmentShaderV300.glsl b/chart2/opengl/shape3DFragmentShaderV300.glsl
index fee81d469d3d..05e27701c807 100644
--- a/chart2/opengl/shape3DFragmentShaderV300.glsl
+++ b/chart2/opengl/shape3DFragmentShaderV300.glsl
@@ -23,9 +23,13 @@ uniform vec4 lightPosWorldspace[MAX_LIGHT_NUM];
uniform float lightPower[MAX_LIGHT_NUM];
uniform int lightNum;
uniform vec4 lightAmbient;
+uniform int undraw;
+uniform float minCoordX;
void main()
{
+ if ((positionWorldspace.x <= minCoordX) && (undraw == 1))
+ discard;
vec3 colorTotal = vec3(0.0f, 0.0f, 0.0f);
vec3 vertexPositionCameraspace = (V * vec4(positionWorldspace,1)).xyz;
diff --git a/chart2/opengl/shape3DVertexShaderV300.glsl b/chart2/opengl/shape3DVertexShaderV300.glsl
index 6737004cb914..a8da294fb3cd 100644
--- a/chart2/opengl/shape3DVertexShaderV300.glsl
+++ b/chart2/opengl/shape3DVertexShaderV300.glsl
@@ -16,12 +16,16 @@ uniform mat4 P;
uniform mat4 M;
uniform mat4 V;
uniform mat3 normalMatrix;
+uniform float minCoordX;
+uniform float maxCoordX;
void main()
{
- gl_Position = P * V * M * vec4(vertexPositionModelspace,1);
+ positionWorldspace = (M * vec4(vertexPositionModelspace,1)).xyz;
- positionWorldspace = (M * vec4(vertexPositionModelspace,1)).xyz;
+ positionWorldspace.x = clamp(positionWorldspace.x, minCoordX, maxCoordX);
+
+ gl_Position = P * V * vec4(positionWorldspace,1);
normalCameraspace = normalize(mat3(V) * normalMatrix * vertexNormalModelspace);
}