|
@@ -153,11 +153,10 @@ int Shader::compile(const char* vertex, const char* fragment) {
|
153
|
153
|
// Check vertex shader
|
154
|
154
|
glGetShaderiv(vertexID, GL_COMPILE_STATUS, &result);
|
155
|
155
|
glGetShaderiv(vertexID, GL_INFO_LOG_LENGTH, &logLength);
|
156
|
|
- if (logLength > 0) {
|
|
156
|
+ if ((logLength > 0) && (result != GL_TRUE)) {
|
157
|
157
|
std::vector<char> message(logLength + 1);
|
158
|
158
|
glGetShaderInfoLog(vertexID, logLength, nullptr, &message[0]);
|
159
|
|
- if (result != GL_TRUE)
|
160
|
|
- Log::get(LOG_ERROR) << "Vertex Shader compilation error:" << Log::endl;
|
|
159
|
+ Log::get(LOG_ERROR) << "Vertex Shader compilation error:" << Log::endl;
|
161
|
160
|
Log::get(LOG_ERROR) << &message[0] << Log::endl;
|
162
|
161
|
glDeleteShader(vertexID);
|
163
|
162
|
glDeleteShader(fragmentID);
|
|
@@ -171,11 +170,10 @@ int Shader::compile(const char* vertex, const char* fragment) {
|
171
|
170
|
// Check fragment shader
|
172
|
171
|
glGetShaderiv(fragmentID, GL_COMPILE_STATUS, &result);
|
173
|
172
|
glGetShaderiv(fragmentID, GL_INFO_LOG_LENGTH, &logLength);
|
174
|
|
- if (logLength > 0) {
|
|
173
|
+ if ((logLength > 0) && (result != GL_TRUE)) {
|
175
|
174
|
std::vector<char> message(logLength + 1);
|
176
|
175
|
glGetShaderInfoLog(fragmentID, logLength, nullptr, &message[0]);
|
177
|
|
- if (result != GL_TRUE)
|
178
|
|
- Log::get(LOG_ERROR) << "Fragment Shader compilation error:" << Log::endl;
|
|
176
|
+ Log::get(LOG_ERROR) << "Fragment Shader compilation error:" << Log::endl;
|
179
|
177
|
Log::get(LOG_ERROR) << &message[0] << Log::endl;
|
180
|
178
|
glDeleteShader(vertexID);
|
181
|
179
|
glDeleteShader(fragmentID);
|
|
@@ -191,11 +189,10 @@ int Shader::compile(const char* vertex, const char* fragment) {
|
191
|
189
|
// Check resulting program
|
192
|
190
|
glGetProgramiv(programID, GL_LINK_STATUS, &result);
|
193
|
191
|
glGetProgramiv(programID, GL_INFO_LOG_LENGTH, &logLength);
|
194
|
|
- if (logLength > 0) {
|
|
192
|
+ if ((logLength > 0) && (result != GL_TRUE)) {
|
195
|
193
|
std::vector<char> message(logLength + 1);
|
196
|
194
|
glGetProgramInfoLog(programID, logLength, nullptr, &message[0]);
|
197
|
|
- if (result != GL_TRUE)
|
198
|
|
- Log::get(LOG_ERROR) << "Shader link error:" << Log::endl;
|
|
195
|
+ Log::get(LOG_ERROR) << "Shader link error:" << Log::endl;
|
199
|
196
|
Log::get(LOG_ERROR) << &message[0] << Log::endl;
|
200
|
197
|
glDeleteShader(vertexID);
|
201
|
198
|
glDeleteShader(fragmentID);
|