Skip to content

Commit

Permalink
possible fix for #74 - undeclared gl_FragmentColor
Browse files Browse the repository at this point in the history
  • Loading branch information
buggins committed Mar 18, 2015
1 parent 115f409 commit 6cfe98a
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/dlangui/graphics/glsupport.d
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class GLProgram {
this() {
}

private void compatibilityFixes(ref char[] code) {
private void compatibilityFixes(ref char[] code, GLuint type) {
if (glslversionInt < 150)
code = replace(code, " texture(", " texture2D(");
}
Expand All @@ -98,7 +98,7 @@ class GLProgram {
sourceCode ~= glslversionString;
sourceCode ~= "\n";
sourceCode ~= src;
compatibilityFixes(sourceCode);
compatibilityFixes(sourceCode, type);

Log.d("compileShader glsl=", glslversion, " type:", (type == GL_VERTEX_SHADER ? "GL_VERTEX_SHADER" : (type == GL_FRAGMENT_SHADER ? "GL_FRAGMENT_SHADER" : "UNKNOWN")), " code:\n", sourceCode);
GLuint shader = glCreateShader(type);//GL_VERTEX_SHADER
Expand Down Expand Up @@ -226,9 +226,10 @@ class SolidFillProgram : GLProgram {
@property override string fragmentSource() {
return
"in " ~ LOWP ~ " vec4 col;\n"
"out " ~ LOWP ~ " vec4 outColor;\n"
"void main(void)\n"
"{\n"
" gl_FragColor = col;\n"
" outColor = col;\n"
"}\n";
}

Expand Down Expand Up @@ -355,9 +356,10 @@ class TextureProgram : SolidFillProgram {
"uniform sampler2D texture;\n"
"in " ~ LOWP ~ " vec4 col;\n"
"in " ~ MEDIUMP ~ " vec4 texc;\n"
"out " ~ LOWP ~ " vec4 outColor;\n"
"void main(void)\n"
"{\n"
" gl_FragColor = texture(texture, texc.st) * col;\n" //texture2D
" outColor = texture(texture, texc.st) * col;\n" //texture2D
"}\n";
}

Expand Down Expand Up @@ -465,9 +467,10 @@ class FontProgram : SolidFillProgram {
"uniform sampler2D texture;\n"
"in " ~ LOWP ~ " vec4 col;\n"
"in " ~ MEDIUMP ~ " vec4 texc;\n"
"out " ~ LOWP ~ " vec4 outColor;\n"
"void main(void)\n"
"{\n"
" gl_FragColor = texture(texture, texc.st) * col;\n"//texture2D
" outColor = texture(texture, texc.st) * col;\n"//texture2D
"}\n";
}

Expand Down

0 comments on commit 6cfe98a

Please sign in to comment.