summaryrefslogtreecommitdiffstats
path: root/src/demos/instancedRendering/shader
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2015-02-03 01:28:08 +0100
committerSven Gothel <[email protected]>2015-02-03 01:28:08 +0100
commitbb384d07649c01f5cac29fffadf88684220ab693 (patch)
tree212ee28d02a11faf29a345f1b34918a008af5de9 /src/demos/instancedRendering/shader
parent606754802fed7086f6b7996b69910b1f085bc3db (diff)
parentb2da4858e8b5cb2ec3131ed76e2c61ad4a8a2e1c (diff)
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'src/demos/instancedRendering/shader')
-rw-r--r--src/demos/instancedRendering/shader/triangles.fp15
-rw-r--r--src/demos/instancedRendering/shader/triangles.vp17
2 files changed, 32 insertions, 0 deletions
diff --git a/src/demos/instancedRendering/shader/triangles.fp b/src/demos/instancedRendering/shader/triangles.fp
new file mode 100644
index 0000000..005884a
--- /dev/null
+++ b/src/demos/instancedRendering/shader/triangles.fp
@@ -0,0 +1,15 @@
+// Copyright 2014 JogAmp Community. All rights reserved.
+
+#if __VERSION__ >= 130
+ #define varying in
+ out vec4 mgl_FragColor;
+ #define texture2D texture
+#else
+ #define mgl_FragColor gl_FragColor
+#endif
+
+varying vec4 frontColor;
+
+void main (void) {
+ mgl_FragColor = frontColor;
+}
diff --git a/src/demos/instancedRendering/shader/triangles.vp b/src/demos/instancedRendering/shader/triangles.vp
new file mode 100644
index 0000000..91cc6ef
--- /dev/null
+++ b/src/demos/instancedRendering/shader/triangles.vp
@@ -0,0 +1,17 @@
+// Copyright 2014 JogAmp Community. All rights reserved.
+
+#if __VERSION__ >= 130
+ #define attribute in
+ #define varying out
+#endif
+
+uniform mat4 mgl_PMatrix;
+uniform mat4 mgl_MVMatrix[NO_OF_INSTANCE];
+attribute vec3 mgl_Vertex;
+attribute vec4 mgl_Color;
+varying vec4 frontColor;
+
+void main(void) {
+ frontColor = mgl_Color;
+ gl_Position = mgl_PMatrix * mgl_MVMatrix[gl_InstanceID] * vec4(mgl_Vertex, 1);
+}