Browse Source

Assertion fail when user is doing something wrong with shaders.

Non-assertion-failing error switched to warning, as it is not fatal.
pull/279/head
Vladimír Vondruš 14 years ago
parent
commit
45200899ed
  1. 5
      src/AbstractShaderProgram.cpp

5
src/AbstractShaderProgram.cpp

@ -15,6 +15,7 @@
#include "AbstractShaderProgram.h" #include "AbstractShaderProgram.h"
#include <cassert>
#include <fstream> #include <fstream>
#define LINKER_MESSAGE_MAX_LENGTH 1024 #define LINKER_MESSAGE_MAX_LENGTH 1024
@ -52,6 +53,7 @@ bool AbstractShaderProgram::attachShader(Shader* shader) {
bool AbstractShaderProgram::bindAttribute(GLuint location, const string& name) { bool AbstractShaderProgram::bindAttribute(GLuint location, const string& name) {
if(state != Initialized) { if(state != Initialized) {
Error() << "AbstractShaderProgram: attribute cannot be bound after linking."; Error() << "AbstractShaderProgram: attribute cannot be bound after linking.";
assert(0);
return false; return false;
} }
@ -109,12 +111,13 @@ void AbstractShaderProgram::link() {
GLint AbstractShaderProgram::uniformLocation(const std::string& name) { GLint AbstractShaderProgram::uniformLocation(const std::string& name) {
if(state != Linked) { if(state != Linked) {
Error() << "AbstractShaderProgram: uniform location cannot be retrieved before linking."; Error() << "AbstractShaderProgram: uniform location cannot be retrieved before linking.";
assert(0);
return -1; return -1;
} }
GLint location = glGetUniformLocation(program, name.c_str()); GLint location = glGetUniformLocation(program, name.c_str());
if(location == -1) if(location == -1)
Error() << "AbstractShaderProgram: location of uniform \'" + name + "\' cannot be retrieved!"; Warning() << "AbstractShaderProgram: location of uniform \'" + name + "\' cannot be retrieved!";
return location; return location;
} }

Loading…
Cancel
Save