From 0124ad0a853e4e10ca2edde708e5ba4f9c89f75b Mon Sep 17 00:00:00 2001 From: rafoudiablol Date: Sun, 6 Apr 2014 22:04:42 +0200 Subject: [PATCH] Show error message everytime a shader uniform's location can't be found. Adjusted code style (TankOs). Original commit message by the author: Show only 1 once the message "Parameter not found" Conflicts: src/SFML/Graphics/Shader.cpp --- src/SFML/Graphics/Shader.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/SFML/Graphics/Shader.cpp b/src/SFML/Graphics/Shader.cpp index 0b3f1751..c5fa4b6a 100644 --- a/src/SFML/Graphics/Shader.cpp +++ b/src/SFML/Graphics/Shader.cpp @@ -601,17 +601,11 @@ int Shader::getParamLocation(const std::string& name) else { // Not in cache, request the location from OpenGL - int location = glCheck(glGetUniformLocationARB(m_shaderProgram, name.c_str())); - if (location != -1) - { - // Location found: add it to the cache - m_params.insert(std::make_pair(name, location)); - } - else - { - // Error: location not found + int location = glGetUniformLocationARB(m_shaderProgram, name.c_str()); + m_params.insert(std::make_pair(name, location)); + + if (location == -1) err() << "Parameter \"" << name << "\" not found in shader" << std::endl; - } return location; }