Use older GLSL ver for compatibility with OpenGL 2.1
This commit is contained in:
parent
e28e7bf111
commit
b05a6bff8f
|
@ -112,10 +112,10 @@ void initTexture (GLuint* texNum, const char* path) {
|
||||||
|
|
||||||
void initShader() {
|
void initShader() {
|
||||||
const char* vsSrc =
|
const char* vsSrc =
|
||||||
"#version 150\n"
|
"#version 120\n"
|
||||||
"in vec2 position;"
|
"attribute vec2 position;"
|
||||||
"in vec2 texcoord;"
|
"attribute vec2 texcoord;"
|
||||||
"out vec2 uv;"
|
"varying vec2 uv;"
|
||||||
"uniform mat4 transMatrix;"
|
"uniform mat4 transMatrix;"
|
||||||
"void main () {"
|
"void main () {"
|
||||||
"gl_Position = transMatrix * vec4(position, 0.0, 1.0);"
|
"gl_Position = transMatrix * vec4(position, 0.0, 1.0);"
|
||||||
|
@ -123,12 +123,11 @@ void initShader() {
|
||||||
"}";
|
"}";
|
||||||
|
|
||||||
const char* fsSrc =
|
const char* fsSrc =
|
||||||
"#version 150\n"
|
"#version 120\n"
|
||||||
"in vec2 uv;"
|
"varying vec2 uv;"
|
||||||
"out vec4 color;"
|
|
||||||
"uniform sampler2D tex;"
|
"uniform sampler2D tex;"
|
||||||
"void main () {"
|
"void main () {"
|
||||||
"color = texture(tex, uv);"
|
"gl_FragColor = texture2D(tex, uv);"
|
||||||
"}";
|
"}";
|
||||||
|
|
||||||
//compile vert shader
|
//compile vert shader
|
||||||
|
@ -152,7 +151,7 @@ void initShader() {
|
||||||
shader = glCreateProgram();
|
shader = glCreateProgram();
|
||||||
glAttachShader(shader, vs);
|
glAttachShader(shader, vs);
|
||||||
glAttachShader(shader, fs);
|
glAttachShader(shader, fs);
|
||||||
glBindFragDataLocation(shader, 0, "color");
|
//glBindFragDataLocation(shader, 0, "color");
|
||||||
glLinkProgram(shader);
|
glLinkProgram(shader);
|
||||||
glUseProgram(shader);
|
glUseProgram(shader);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue