From b05a6bff8f929718baa0628d91bc3dc70aab8eb4 Mon Sep 17 00:00:00 2001 From: Epicalert Date: Wed, 13 Jan 2021 17:48:21 +0800 Subject: [PATCH] Use older GLSL ver for compatibility with OpenGL 2.1 --- src/graphics.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/graphics.cpp b/src/graphics.cpp index 2e18330..e3eb87d 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -112,10 +112,10 @@ void initTexture (GLuint* texNum, const char* path) { void initShader() { const char* vsSrc = - "#version 150\n" - "in vec2 position;" - "in vec2 texcoord;" - "out vec2 uv;" + "#version 120\n" + "attribute vec2 position;" + "attribute vec2 texcoord;" + "varying vec2 uv;" "uniform mat4 transMatrix;" "void main () {" "gl_Position = transMatrix * vec4(position, 0.0, 1.0);" @@ -123,12 +123,11 @@ void initShader() { "}"; const char* fsSrc = - "#version 150\n" - "in vec2 uv;" - "out vec4 color;" + "#version 120\n" + "varying vec2 uv;" "uniform sampler2D tex;" "void main () {" - "color = texture(tex, uv);" + "gl_FragColor = texture2D(tex, uv);" "}"; //compile vert shader @@ -152,7 +151,7 @@ void initShader() { shader = glCreateProgram(); glAttachShader(shader, vs); glAttachShader(shader, fs); - glBindFragDataLocation(shader, 0, "color"); + //glBindFragDataLocation(shader, 0, "color"); glLinkProgram(shader); glUseProgram(shader);