diff options
author | Peilin <peilin@multicorewareinc.com> | 2014-01-23 02:49:10 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-01-29 08:09:56 +0100 |
commit | a7b0b253f086cd8c5d7947d9e1d958263c18a3e3 (patch) | |
tree | a7f8e367cd0d720d25ee4ac64b11f1b6c16e7581 /chart2/opengl | |
parent | 06f4573a87d861c50c0017702aed75a389619b46 (diff) |
add Symbol2D rendering
Change-Id: Ic294ffc4bc675495fe83ac182dbebbba7245c7b9
Diffstat (limited to 'chart2/opengl')
-rw-r--r-- | chart2/opengl/backgroundFragmentShader.glsl | 6 | ||||
-rw-r--r-- | chart2/opengl/backgroundVertexShader.glsl | 10 | ||||
-rw-r--r-- | chart2/opengl/commonFragmentShader.glsl | 6 | ||||
-rw-r--r-- | chart2/opengl/commonVertexShader.glsl | 10 | ||||
-rw-r--r-- | chart2/opengl/debugFragmentShader.glsl | 7 | ||||
-rw-r--r-- | chart2/opengl/debugVertexShader.glsl | 9 | ||||
-rw-r--r-- | chart2/opengl/renderFragmentShader.glsl | 7 | ||||
-rw-r--r-- | chart2/opengl/renderVertexShader.glsl | 9 | ||||
-rw-r--r-- | chart2/opengl/symbolFragmentShader.glsl | 12 | ||||
-rw-r--r-- | chart2/opengl/symbolVertexShader.glsl | 13 | ||||
-rw-r--r-- | chart2/opengl/textFragmentShader.glsl | 6 | ||||
-rw-r--r-- | chart2/opengl/textVertexShader.glsl | 9 |
12 files changed, 104 insertions, 0 deletions
diff --git a/chart2/opengl/backgroundFragmentShader.glsl b/chart2/opengl/backgroundFragmentShader.glsl new file mode 100644 index 000000000000..e772587c9835 --- /dev/null +++ b/chart2/opengl/backgroundFragmentShader.glsl @@ -0,0 +1,6 @@ +varying vec4 fragmentColor; + +void main() +{ + gl_FragColor = fragmentColor; +} diff --git a/chart2/opengl/backgroundVertexShader.glsl b/chart2/opengl/backgroundVertexShader.glsl new file mode 100644 index 000000000000..2a3a34116256 --- /dev/null +++ b/chart2/opengl/backgroundVertexShader.glsl @@ -0,0 +1,10 @@ +attribute vec3 vPosition; +uniform mat4 MVP; +attribute vec4 vColor; +varying vec4 fragmentColor; + +void main() +{ + gl_Position = MVP * vec4(vPosition, 1); + fragmentColor = vColor; +} diff --git a/chart2/opengl/commonFragmentShader.glsl b/chart2/opengl/commonFragmentShader.glsl new file mode 100644 index 000000000000..e772587c9835 --- /dev/null +++ b/chart2/opengl/commonFragmentShader.glsl @@ -0,0 +1,6 @@ +varying vec4 fragmentColor; + +void main() +{ + gl_FragColor = fragmentColor; +} diff --git a/chart2/opengl/commonVertexShader.glsl b/chart2/opengl/commonVertexShader.glsl new file mode 100644 index 000000000000..862a35b509f4 --- /dev/null +++ b/chart2/opengl/commonVertexShader.glsl @@ -0,0 +1,10 @@ +attribute vec3 vPosition; +uniform mat4 MVP; +uniform vec4 vColor; +varying vec4 fragmentColor; + +void main() +{ + gl_Position = MVP * vec4(vPosition, 1); + fragmentColor = vColor; +} diff --git a/chart2/opengl/debugFragmentShader.glsl b/chart2/opengl/debugFragmentShader.glsl new file mode 100644 index 000000000000..ce7f863f3394 --- /dev/null +++ b/chart2/opengl/debugFragmentShader.glsl @@ -0,0 +1,7 @@ +varying vec4 fragmentColor; + +void main() +{ + gl_FragColor = vec4(1.0, 1.0, 0.0, 0.5); +} + diff --git a/chart2/opengl/debugVertexShader.glsl b/chart2/opengl/debugVertexShader.glsl new file mode 100644 index 000000000000..c0f3d0322652 --- /dev/null +++ b/chart2/opengl/debugVertexShader.glsl @@ -0,0 +1,9 @@ +attribute vec3 vPosition; +uniform vec4 vColor; +varying vec4 fragmentColor; + +void main() +{ + gl_Position = vec4(vPosition, 1); +} + diff --git a/chart2/opengl/renderFragmentShader.glsl b/chart2/opengl/renderFragmentShader.glsl new file mode 100644 index 000000000000..dd08d9a4a2cd --- /dev/null +++ b/chart2/opengl/renderFragmentShader.glsl @@ -0,0 +1,7 @@ +uniform sampler2D RenderTex; +varying vec2 vTexCoord; + +void main() +{ + gl_FragColor = vec4(texture2D(RenderTex, vTexCoord).rgb, 1.0); +} diff --git a/chart2/opengl/renderVertexShader.glsl b/chart2/opengl/renderVertexShader.glsl new file mode 100644 index 000000000000..1c9d3ce647dd --- /dev/null +++ b/chart2/opengl/renderVertexShader.glsl @@ -0,0 +1,9 @@ +attribute vec4 vPosition; +attribute vec2 texCoord; +varying vec2 vTexCoord; + +void main() +{ + gl_Position = vPosition; + vTexCoord = texCoord; +} diff --git a/chart2/opengl/symbolFragmentShader.glsl b/chart2/opengl/symbolFragmentShader.glsl new file mode 100644 index 000000000000..c340be274337 --- /dev/null +++ b/chart2/opengl/symbolFragmentShader.glsl @@ -0,0 +1,12 @@ +#version 130 + +varying vec4 fragmentColor; + +void main() +{ + vec2 p = gl_PointCoord * 2.0 - vec2(1.0); // (0,0) in the center + if (abs(p.x) < abs(p.y)) + discard; + + gl_FragColor = fragmentColor; +} diff --git a/chart2/opengl/symbolVertexShader.glsl b/chart2/opengl/symbolVertexShader.glsl new file mode 100644 index 000000000000..6aef1e8a2146 --- /dev/null +++ b/chart2/opengl/symbolVertexShader.glsl @@ -0,0 +1,13 @@ +#version 130 + +attribute vec3 vPosition; +uniform mat4 MVP; +uniform vec4 vColor; +varying vec4 fragmentColor; + +void main() +{ + gl_Position = MVP * vec4(vPosition, 1); + fragmentColor = vColor; + gl_PointSize = 10.0; +} diff --git a/chart2/opengl/textFragmentShader.glsl b/chart2/opengl/textFragmentShader.glsl new file mode 100644 index 000000000000..83d0d82550be --- /dev/null +++ b/chart2/opengl/textFragmentShader.glsl @@ -0,0 +1,6 @@ +uniform sampler2D TextTex; +varying vec2 vTexCoord; +void main() +{ + gl_FragColor = vec4(texture2D(TextTex, vTexCoord).rgba); +} diff --git a/chart2/opengl/textVertexShader.glsl b/chart2/opengl/textVertexShader.glsl new file mode 100644 index 000000000000..013f43c6157a --- /dev/null +++ b/chart2/opengl/textVertexShader.glsl @@ -0,0 +1,9 @@ +attribute vec3 vPosition; +uniform mat4 MVP; +attribute vec2 texCoord; +varying vec2 vTexCoord; +void main() +{ + gl_Position = MVP * vec4(vPosition, 1); + vTexCoord = texCoord; +} |