|
@@ -210,13 +210,18 @@ Shader::Shader(char const *vert, char const *frag) |
|
|
glShaderSource(data->vert_id, 1, &shader, NULL); |
|
|
glShaderSource(data->vert_id, 1, &shader, NULL); |
|
|
glCompileShader(data->vert_id); |
|
|
glCompileShader(data->vert_id); |
|
|
|
|
|
|
|
|
|
|
|
glGetShaderInfoLog(data->vert_id, sizeof(errbuf), &len, errbuf); |
|
|
glGetShaderiv(data->vert_id, GL_COMPILE_STATUS, &status); |
|
|
glGetShaderiv(data->vert_id, GL_COMPILE_STATUS, &status); |
|
|
if (status != GL_TRUE) |
|
|
if (status != GL_TRUE) |
|
|
{ |
|
|
{ |
|
|
glGetShaderInfoLog(data->vert_id, sizeof(errbuf), &len, errbuf); |
|
|
|
|
|
Log::Error("failed to compile vertex shader: %s", errbuf); |
|
|
Log::Error("failed to compile vertex shader: %s", errbuf); |
|
|
Log::Error("shader source:\n%s\n", buf); |
|
|
Log::Error("shader source:\n%s\n", buf); |
|
|
} |
|
|
} |
|
|
|
|
|
else if (len > 1) |
|
|
|
|
|
{ |
|
|
|
|
|
Log::Debug("compile log for vertex shader: %s", errbuf); |
|
|
|
|
|
Log::Debug("shader source:\n%s\n", buf); |
|
|
|
|
|
} |
|
|
#else |
|
|
#else |
|
|
data->vert_id = cgCreateProgram(cgCreateContext(), CG_SOURCE, vert, |
|
|
data->vert_id = cgCreateProgram(cgCreateContext(), CG_SOURCE, vert, |
|
|
cgGLGetLatestProfile(CG_GL_VERTEX), |
|
|
cgGLGetLatestProfile(CG_GL_VERTEX), |
|
@@ -249,13 +254,18 @@ Shader::Shader(char const *vert, char const *frag) |
|
|
glShaderSource(data->frag_id, 1, &shader, NULL); |
|
|
glShaderSource(data->frag_id, 1, &shader, NULL); |
|
|
glCompileShader(data->frag_id); |
|
|
glCompileShader(data->frag_id); |
|
|
|
|
|
|
|
|
|
|
|
glGetShaderInfoLog(data->frag_id, sizeof(errbuf), &len, errbuf); |
|
|
glGetShaderiv(data->frag_id, GL_COMPILE_STATUS, &status); |
|
|
glGetShaderiv(data->frag_id, GL_COMPILE_STATUS, &status); |
|
|
if (status != GL_TRUE) |
|
|
if (status != GL_TRUE) |
|
|
{ |
|
|
{ |
|
|
glGetShaderInfoLog(data->frag_id, sizeof(errbuf), &len, errbuf); |
|
|
|
|
|
Log::Error("failed to compile fragment shader: %s", errbuf); |
|
|
Log::Error("failed to compile fragment shader: %s", errbuf); |
|
|
Log::Error("shader source:\n%s\n", buf); |
|
|
Log::Error("shader source:\n%s\n", buf); |
|
|
} |
|
|
} |
|
|
|
|
|
else if (len > 1) |
|
|
|
|
|
{ |
|
|
|
|
|
Log::Debug("compile log for fragment shader: %s", errbuf); |
|
|
|
|
|
Log::Debug("shader source:\n%s\n", buf); |
|
|
|
|
|
} |
|
|
#else |
|
|
#else |
|
|
data->frag_id = cgCreateProgram(cgCreateContext(), CG_SOURCE, frag, |
|
|
data->frag_id = cgCreateProgram(cgCreateContext(), CG_SOURCE, frag, |
|
|
cgGLGetLatestProfile(CG_GL_FRAGMENT), |
|
|
cgGLGetLatestProfile(CG_GL_FRAGMENT), |
|
@@ -293,6 +303,16 @@ Shader::Shader(char const *vert, char const *frag) |
|
|
glAttachShader(data->prog_id, data->frag_id); |
|
|
glAttachShader(data->prog_id, data->frag_id); |
|
|
|
|
|
|
|
|
glLinkProgram(data->prog_id); |
|
|
glLinkProgram(data->prog_id); |
|
|
|
|
|
glGetProgramInfoLog(data->prog_id, sizeof(errbuf), &len, errbuf); |
|
|
|
|
|
glGetProgramiv(data->prog_id, GL_LINK_STATUS, &status); |
|
|
|
|
|
if (status != GL_TRUE) |
|
|
|
|
|
{ |
|
|
|
|
|
Log::Error("failed to link program: %s", errbuf); |
|
|
|
|
|
} |
|
|
|
|
|
else if (len > 1) |
|
|
|
|
|
{ |
|
|
|
|
|
Log::Debug("link log for program: %s", errbuf); |
|
|
|
|
|
} |
|
|
glValidateProgram(data->prog_id); |
|
|
glValidateProgram(data->prog_id); |
|
|
#endif |
|
|
#endif |
|
|
} |
|
|
} |
|
|