Commit bd934fce authored by Robert Menzel's avatar Robert Menzel
Browse files

readded warning supression from GLM, cleanups

parent 708174d6
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2011, Computer Graphics Group RWTH Aachen University // // Copyright (c) 2011, 2012 Computer Graphics Group RWTH Aachen University //
// All rights reserved. // // All rights reserved. //
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
...@@ -18,20 +18,59 @@ ...@@ -18,20 +18,59 @@
* this, you should never include glm yourself, but include always our ACGL/Math.hh! * this, you should never include glm yourself, but include always our ACGL/Math.hh!
*/ */
/////////////////////////////////////////////////////////////////////////////////////
// ignore compiler warnings from GLM:
//
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning( push ) #pragma warning( push )
#pragma warning ( disable : 4201 ) #pragma warning ( disable : 4201 )
#pragma warning ( disable : 4100 ) #pragma warning ( disable : 4100 )
#pragma warning ( disable : 4996 ) #pragma warning ( disable : 4996 )
#pragma warning ( disable : 4244 ) #pragma warning ( disable : 4244 )
#endif #endif
#if (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4))
#define COMPILER_IS_GCC_4_6_OR_NEWER
#endif
#ifdef __clang__
// clang/llvm:
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wuninitialized"
# pragma clang diagnostic ignored "-Wunused-parameter"
#elif defined __GNUC__
# ifdef COMPILER_IS_GCC_4_6_OR_NEWER
// gcc >= 4.6:
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wtype-limits"
# endif
// gcc:
# pragma GCC diagnostic ignored "-Wunused-parameter"
#endif
//
/////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp> #include <glm/glm.hpp>
#include <glm/ext.hpp> #include <glm/ext.hpp>
#ifdef _MSC_VER
/////////////////////////////////////////////////////////////////////////////////////
// reactivate compiler warnings:
//
#ifdef __clang__
// clang/llvm:
# pragma clang diagnostic pop
#elif defined COMPILER_IS_GCC_4_6_OR_NEWER
// gcc >= 4.6:
# pragma GCC diagnostic pop
#endif
#ifdef _MSC_VER
#pragma warning( pop ) #pragma warning( pop )
#endif #endif
//
/////////////////////////////////////////////////////////////////////////////////////
#include <ACGL/Math/Constants.hh> #include <ACGL/Math/Constants.hh>
#include <ACGL/Math/Functions.hh> #include <ACGL/Math/Functions.hh>
......
...@@ -169,29 +169,29 @@ public: ...@@ -169,29 +169,29 @@ public:
//! Set data for this buffer. Use only to init the buffer! //! Set data for this buffer. Use only to init the buffer!
//! Note: The function is not const, because it changes the corresponding GPU data //! Note: The function is not const, because it changes the corresponding GPU data
inline void setData( GLenum _target, GLsizeiptr _size, const GLvoid *_pData = NULL, GLenum _usage = GL_STATIC_DRAW ) { inline void setData( GLenum _target, GLsizeiptr _sizeInBytes, const GLvoid *_pData = NULL, GLenum _usage = GL_STATIC_DRAW ) {
mSize = _size; mSize = _sizeInBytes;
bind( _target ); bind( _target );
glBufferData( _target, _size, _pData, _usage ); glBufferData( _target, _sizeInBytes, _pData, _usage );
openGLRareError(); openGLRareError();
} }
//! Set data for this buffer at the last used target. Use only to init the buffer! //! Set data for this buffer at the last used target. Use only to init the buffer!
inline void setData( GLsizeiptr _size, const GLvoid *_pData = NULL, GLenum _usage = GL_STATIC_DRAW ) { inline void setData( GLsizeiptr _sizeInBytes, const GLvoid *_pData = NULL, GLenum _usage = GL_STATIC_DRAW ) {
setData( mTarget, _size, _pData, _usage ); setData( mTarget, _sizeInBytes, _pData, _usage );
} }
//! Use this to modify the buffer //! Use this to modify the buffer
inline void setSubData( GLenum _target, GLintptr _offset, inline void setSubData( GLenum _target, GLintptr _offset,
GLsizeiptr _size, const GLvoid *_pData ) { GLsizeiptr _sizeInBytes, const GLvoid *_pData ) {
bind( _target ); bind( _target );
glBufferSubData( _target, _offset, _size, _pData ); glBufferSubData( _target, _offset, _sizeInBytes, _pData );
openGLRareError(); openGLRareError();
} }
//! Use this to modify the buffer //! Use this to modify the buffer
inline void setSubData( GLintptr _offset, GLsizeiptr _size, const GLvoid *_pData ) { inline void setSubData( GLintptr _offset, GLsizeiptr _sizeInBytes, const GLvoid *_pData ) {
setSubData( mTarget, _offset, _size, _pData ); setSubData( mTarget, _offset, _sizeInBytes, _pData );
} }
...@@ -316,7 +316,7 @@ public: ...@@ -316,7 +316,7 @@ public:
// ============================================================================================ FIELDS \/ // ============================================================================================ FIELDS \/
// =================================================================================================== \/ // =================================================================================================== \/
protected: protected:
GLint64 mSize; // as this might get queried often (e.g. ArrayBuffer) we will explicitly mirror it in RAM) GLint64 mSize; // as this might get queried often (e.g. ArrayBuffer) we will explicitly mirror it in RAM - bytes
SharedBufferObject mBuffer; SharedBufferObject mBuffer;
GLenum mTarget; GLenum mTarget;
}; };
......
...@@ -284,7 +284,7 @@ public: ...@@ -284,7 +284,7 @@ public:
//! set the texture to the texture unit the uniform is set to. //! 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! //! Note: it is not guaranteed that all uniforms for textures are set to unique samplers by default after linking!
void setTexture( const std::string& _nameInShader, const ConstSharedTexture& _texture ) { void setTexture( const std::string& _nameInShader, const ConstSharedTexture& _texture ) const {
GLint unit; GLint unit;
GLint uniformLocation = getUniformLocation(_nameInShader); GLint uniformLocation = getUniformLocation(_nameInShader);
if ( uniformLocation != -1 ) { if ( uniformLocation != -1 ) {
......
...@@ -128,17 +128,7 @@ void ShaderProgramControlFiles::setBindings(SharedShaderProgram &_shaderProgram) ...@@ -128,17 +128,7 @@ void ShaderProgramControlFiles::setBindings(SharedShaderProgram &_shaderProgram)
_shaderProgram->setFragmentDataLocations( mFragmentDataLocations ); // will relink on it's own _shaderProgram->setFragmentDataLocations( mFragmentDataLocations ); // will relink on it's own
SharedLocationMappings oldMap = _shaderProgram->getAttributeLocations(); SharedLocationMappings oldMap = _shaderProgram->getAttributeLocations();
Utils::debug() << "oldmap:"<<std::endl;
oldMap->printMapping();
Utils::debug() << "mAttributeLocations before:"<<std::endl;
mAttributeLocations->printMapping();
mAttributeLocations->addLocations( oldMap ); // add as many old locations as possible without destoying the location map mAttributeLocations->addLocations( oldMap ); // add as many old locations as possible without destoying the location map
Utils::debug() << "mAttributeLocations after:"<<std::endl;
mAttributeLocations->printMapping();
_shaderProgram->setAttributeLocations( mAttributeLocations ); // will relink on it's own _shaderProgram->setAttributeLocations( mAttributeLocations ); // will relink on it's own
# else # else
if ( (mAttributeLocations->getSize() > 0) && (mFragmentDataLocations->getSize() > 0) ) { if ( (mAttributeLocations->getSize() > 0) && (mFragmentDataLocations->getSize() > 0) ) {
......
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