do binding of VS inputs and FS outputs before linking shader programs, as per OpenGL standard.

should fix the rendering issues with strict drivers (AMD, Intel).
This commit is contained in:
Arisotura
2019-05-31 02:26:13 +02:00
parent 6f5e45ef2c
commit 06e08b053f
4 changed files with 37 additions and 15 deletions

View File

@ -85,6 +85,14 @@ bool OpenGL_BuildShaderProgram(const char* vs, const char* fs, GLuint* ids, cons
ids[2] = glCreateProgram();
glAttachShader(ids[2], ids[0]);
glAttachShader(ids[2], ids[1]);
return true;
}
bool OpenGL_LinkShaderProgram(GLuint* ids)
{
int res;
glLinkProgram(ids[2]);
glGetProgramiv(ids[2], GL_LINK_STATUS, &res);
@ -94,7 +102,7 @@ bool OpenGL_BuildShaderProgram(const char* vs, const char* fs, GLuint* ids, cons
if (res < 1) res = 1024;
char* log = new char[res+1];
glGetProgramInfoLog(ids[2], res+1, NULL, log);
printf("OpenGL: failed to link program %s: %s\n", name, log);
printf("OpenGL: failed to link shader program: %s\n", log);
delete[] log;
glDeleteShader(ids[0]);