Commit 16474f3d authored by Robert Menzel's avatar Robert Menzel

fixed setTexture bug (wrong datatype), fixed ACGL init bug for core profiles, added missing file

parent e542cd55
......@@ -43,6 +43,9 @@ public:
// ============================================================================================ METHODS \/
// ==================================================================================================== \/
public:
inline TextureControl& size ( const glm::vec2 &_size ) { return size(_size.x, _size.y); }
inline TextureControl& size ( const glm::vec3 &_size ) { return size(_size.x, _size.y, _size.z); }
inline TextureControl& size (GLsizei _width, GLsizei _height = 0, GLsizei _depth = 0)
{
mWidth = _width;
......
......@@ -139,10 +139,6 @@
# endif
#endif
#ifdef QT_OPENGL_LIB
# include <QtOpenGL/qgl.h>
#endif // USE_QT
//
// our own "extension":
//
......
......@@ -244,10 +244,10 @@ public:
#endif // OpenGL >= 4.0
//! sets a texture uniform to a given texture unit and also binds the texture to the same unit
inline void setTexture (GLint _location, const ConstSharedTexture& _texture, GLenum _unit) const { glUniform1i(_location, _unit); _texture->bind(_unit); }
inline void setTexture (const std::string& _nameInShader, const ConstSharedTexture& _texture, GLenum _unit) const { setUniform( getUniformLocation(_nameInShader), (GLint) _unit); _texture->bind(_unit); }
inline void setProgramTexture (GLint _location, const ConstSharedTexture& _texture, GLenum _unit) const { glProgramUniform1i(mObjectName, _location, _unit); _texture->bind(_unit); }
inline void setProgramTexture (const std::string& _nameInShader, const ConstSharedTexture& _texture, GLenum _unit) const { setProgramUniform( getUniformLocation(_nameInShader), (GLint) _unit); _texture->bind(_unit); }
inline void setTexture (GLint _location, const ConstSharedTexture& _texture, GLint _unit) const { glUniform1i(_location, _unit); _texture->bind(_unit); }
inline void setTexture (const std::string& _nameInShader, const ConstSharedTexture& _texture, GLint _unit) const { setUniform( getUniformLocation(_nameInShader), (GLint) _unit); _texture->bind(_unit); }
inline void setProgramTexture (GLint _location, const ConstSharedTexture& _texture, GLint _unit) const { glProgramUniform1i(mObjectName, _location, _unit); _texture->bind(_unit); }
inline void setProgramTexture (const std::string& _nameInShader, const ConstSharedTexture& _texture, GLint _unit) const { setProgramUniform( getUniformLocation(_nameInShader), (GLint) _unit); _texture->bind(_unit); }
//! set the texture to the texture unit the uniform is set to.
//! Note: it is not guaranteed that all uniforms for textures are set to unique samplers by default after linking!
......
......@@ -22,7 +22,7 @@ bool init(void)
//
#ifdef ACGL_USE_GLEW
# ifdef ACGL_OPENGL_PROFILE_CORE
glewExperimental = TRUE;
glewExperimental = GL_TRUE;
# endif
GLenum errorCode = glewInit();
......
////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2011, Computer Graphics Group RWTH Aachen University //
// All rights reserved. //
////////////////////////////////////////////////////////////////////////////////
#include <ACGL/OpenGL/Objects/LocationMappings.hh>
using namespace ACGL;
using namespace ACGL::OpenGL;
GLint LocationMappings::getLocation(const std::string& _name) const
{
LocationMap::const_iterator location = mMappings.find(_name);
if (location == mMappings.end())
{
return (GLint) -1;
}
else
{
return (GLint) location->second;
}
}
void LocationMappings::setLocation(const std::string& _name, GLuint _location)
{
LocationMap::const_iterator location = mMappings.find(_name);
if (location != mMappings.end() && (location->second != _location))
{
ACGL::Utils::warning() << "LocationMappings: Overwriting location mapping for " << _name;
ACGL::Utils::warning() << " (previous value: " << mMappings[_name] << ", new value: " << _location<< ")" << std::endl;
}
mMappings[_name] = _location;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment