summaryrefslogtreecommitdiff
path: root/chart2/opengl
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-03-17 05:06:00 +0100
committerMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-03-17 08:13:49 +0100
commit40ea5e9dd0eff66728d1d2d7aac41349a14de594 (patch)
tree135fdbd05d5dcc0859351891482277158f143028 /chart2/opengl
parentbd78139dcbf804e6e0b8be5409436991ac08b36c (diff)
Revert "Move OpenGLRender to vcl"
This reverts commit 04b70c682e2cdc52b144961a83d05fd203de6884. The OpenGLRender is not abstract enough for vcl. Leave it in chart2. Conflicts: chart2/source/view/inc/DummyXShape.hxx chart2/source/view/main/OpenGLRender.hxx vcl/Library_vclopengl.mk Change-Id: I5392c8ee34462ff49059126ca2284d8ebe1eb379
Diffstat (limited to 'chart2/opengl')
-rw-r--r--chart2/opengl/backgroundFragmentShader.glsl17
-rw-r--r--chart2/opengl/backgroundVertexShader.glsl21
-rw-r--r--chart2/opengl/commonFragmentShader.glsl17
-rw-r--r--chart2/opengl/commonVertexShader.glsl21
-rw-r--r--chart2/opengl/debugFragmentShader.glsl17
-rw-r--r--chart2/opengl/debugVertexShader.glsl19
-rw-r--r--chart2/opengl/symbolFragmentShader.glsl101
-rw-r--r--chart2/opengl/symbolVertexShader.glsl23
-rw-r--r--chart2/opengl/textFragmentShader.glsl17
-rw-r--r--chart2/opengl/textVertexShader.glsl20
10 files changed, 273 insertions, 0 deletions
diff --git a/chart2/opengl/backgroundFragmentShader.glsl b/chart2/opengl/backgroundFragmentShader.glsl
new file mode 100644
index 000000000000..805789e731ed
--- /dev/null
+++ b/chart2/opengl/backgroundFragmentShader.glsl
@@ -0,0 +1,17 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * 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/.
+ */
+
+varying vec4 fragmentColor;
+
+void main()
+{
+ gl_FragColor = fragmentColor;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/opengl/backgroundVertexShader.glsl b/chart2/opengl/backgroundVertexShader.glsl
new file mode 100644
index 000000000000..6d9d6c21f3c9
--- /dev/null
+++ b/chart2/opengl/backgroundVertexShader.glsl
@@ -0,0 +1,21 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * 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/.
+ */
+
+attribute vec3 vPosition;
+uniform mat4 MVP;
+attribute vec4 vColor;
+varying vec4 fragmentColor;
+
+void main()
+{
+ gl_Position = MVP * vec4(vPosition, 1);
+ fragmentColor = vColor;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/opengl/commonFragmentShader.glsl b/chart2/opengl/commonFragmentShader.glsl
new file mode 100644
index 000000000000..805789e731ed
--- /dev/null
+++ b/chart2/opengl/commonFragmentShader.glsl
@@ -0,0 +1,17 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * 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/.
+ */
+
+varying vec4 fragmentColor;
+
+void main()
+{
+ gl_FragColor = fragmentColor;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/opengl/commonVertexShader.glsl b/chart2/opengl/commonVertexShader.glsl
new file mode 100644
index 000000000000..f32e3fd38a91
--- /dev/null
+++ b/chart2/opengl/commonVertexShader.glsl
@@ -0,0 +1,21 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * 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/.
+ */
+
+attribute vec3 vPosition;
+uniform mat4 MVP;
+uniform vec4 vColor;
+varying vec4 fragmentColor;
+
+void main()
+{
+ gl_Position = MVP * vec4(vPosition, 1);
+ fragmentColor = vColor;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/opengl/debugFragmentShader.glsl b/chart2/opengl/debugFragmentShader.glsl
new file mode 100644
index 000000000000..d36c4f4d46e4
--- /dev/null
+++ b/chart2/opengl/debugFragmentShader.glsl
@@ -0,0 +1,17 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * 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/.
+ */
+
+varying vec4 fragmentColor;
+
+void main()
+{
+ gl_FragColor = vec4(1.0, 1.0, 0.0, 0.5);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/opengl/debugVertexShader.glsl b/chart2/opengl/debugVertexShader.glsl
new file mode 100644
index 000000000000..762de3121419
--- /dev/null
+++ b/chart2/opengl/debugVertexShader.glsl
@@ -0,0 +1,19 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * 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/.
+ */
+
+attribute vec3 vPosition;
+uniform vec4 vColor;
+varying vec4 fragmentColor;
+
+void main()
+{
+ gl_Position = vec4(vPosition, 1);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/opengl/symbolFragmentShader.glsl b/chart2/opengl/symbolFragmentShader.glsl
new file mode 100644
index 000000000000..3ac6b0305285
--- /dev/null
+++ b/chart2/opengl/symbolFragmentShader.glsl
@@ -0,0 +1,101 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * 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(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) // arrow right
+ {
+ 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) // arrow left
+ {
+ 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) // hour glass
+ {
+ if(abs(p.x) < abs(p.y))
+ discard;
+ }
+ else if(shape == 7) // bow tie
+ {
+ if(abs(p.y) < abs(p.x))
+ discard;
+ }
+ else if(shape == 8) // circle
+ {
+ if(dot(p.x, p.y) > 1)
+ discard;
+ }
+ else if(shape == 9) // star
+ {
+ if(sqrt(abs(p.x))+sqrt(abs(p.y)) > 1)
+ discard;
+ }
+ else if(shape == 10) // X
+ {
+ if(abs(abs(p.x) - abs(p.y)) > 0.2)
+ discard;
+ }
+ else if(shape == 11) // Plus
+ {
+ if(abs(p.x) > 0.2 && abs(p.y) > 0.2)
+ discard;
+ }
+ else if(shape == 12) // asterisk
+ {
+ }
+ else if(shape == 13) // horizontal bar
+ {
+ if(abs(p.y) > 0.2)
+ discard;
+ }
+ else if(shape == 14) // vertical bar
+ {
+ if(abs(p.x) > 0.2)
+ discard;
+ }
+
+ gl_FragColor = fragmentColor;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/opengl/symbolVertexShader.glsl b/chart2/opengl/symbolVertexShader.glsl
new file mode 100644
index 000000000000..3cf9f41ef21b
--- /dev/null
+++ b/chart2/opengl/symbolVertexShader.glsl
@@ -0,0 +1,23 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * 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
+
+attribute vec3 vPosition;
+uniform mat4 MVP;
+uniform vec4 vColor;
+varying vec4 fragmentColor;
+
+void main()
+{
+ gl_Position = MVP * vec4(vPosition, 1);
+ fragmentColor = vColor;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/opengl/textFragmentShader.glsl b/chart2/opengl/textFragmentShader.glsl
new file mode 100644
index 000000000000..ef8d44d6949d
--- /dev/null
+++ b/chart2/opengl/textFragmentShader.glsl
@@ -0,0 +1,17 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * 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/.
+ */
+
+uniform sampler2D TextTex;
+varying vec2 vTexCoord;
+void main()
+{
+ gl_FragColor = vec4(texture2D(TextTex, vTexCoord).rgba);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/opengl/textVertexShader.glsl b/chart2/opengl/textVertexShader.glsl
new file mode 100644
index 000000000000..a805229eb07a
--- /dev/null
+++ b/chart2/opengl/textVertexShader.glsl
@@ -0,0 +1,20 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * 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/.
+ */
+
+attribute vec3 vPosition;
+uniform mat4 MVP;
+attribute vec2 texCoord;
+varying vec2 vTexCoord;
+void main()
+{
+ gl_Position = MVP * vec4(vPosition, 1);
+ vTexCoord = texCoord;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */