aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/Graphics/base.shader.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/libjin/Graphics/base.shader.h')
-rw-r--r--src/libjin/Graphics/base.shader.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/libjin/Graphics/base.shader.h b/src/libjin/Graphics/base.shader.h
new file mode 100644
index 0000000..6efb710
--- /dev/null
+++ b/src/libjin/Graphics/base.shader.h
@@ -0,0 +1,26 @@
+
+const static char* default_tex = "_tex0_";
+
+const static char* base_shader = R"(
+#define number float
+#define Texture sampler2D
+#define Canvas sampler2D
+#define Color vec4
+#define Texel texture2D
+#define extern uniform
+
+extern Texture %s;
+%s
+void main()
+{
+ gl_FragColor = effect(gl_Color, %s, gl_TexCoord[0].xy, gl_FragCoord.xy);
+}
+)";
+#define formatShader(buf, program)\
+ sprintf(buf, base_shader, default_tex, program, default_tex)
+/*
+ * https://stackoverflow.com/questions/10868958/what-does-sampler2d-store
+ * The sampler2D is bound to a texture unit. The glUniform call binds it to texture
+ * unit zero. The glActiveTexture call is only needed if you are going to use multiple
+ * texture units (because GL_TEXTURE0 is the default anyway).
+*/ \ No newline at end of file