bastiaanolij wrote on Thursday, January 21, 2016:
Kengo, are you sure returning 0 is a problem? Many OpenGL objects start counting at 0 so a shader with ID 0 may not be an issue.
This is my shader init code:
// create our shader
shader = glCreateShader(pShaderType);
// compile our shader
stringptrs[0] = pShaderText;
glShaderSource(shader, 1, stringptrs, NULL);
glCompileShader(shader);
// check our status
glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled);
if (!compiled) {
...
Note how I do not check anything until after I attempt to compile my shader. I’m testing this on 10.11 but I started my project when I was still on 10.8 so…
You can find the full source here: https://github.com/BastiaanOlij/glfw-tutorial/blob/master/include/shaders.h