Commit 2bed8313 authored by Robert Menzel's avatar Robert Menzel
Browse files

Reduced warnings, minor setUniform bug fixed

* Reduced warnings (by adding casts, removing unused variables etc)
* Deactivated warnings inside of GLM (gcc only)
* Fixed setUniform bug where the transposed parameter for matrixes was ignored
parent 3b550c48
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
//Macro to make a class not copyable //Macro to make a class not copyable
#define ACGL_NOT_COPYABLE(Class) \ #define ACGL_NOT_COPYABLE(Class) \
private:\ private:\
Class(const Class& other){ }\ Class(const Class& ){ }\
void operator=(Class& other){ } void operator=(Class& ){ }
#define ACGL_SHARED_TYPEDEF(Class) \ #define ACGL_SHARED_TYPEDEF(Class) \
typedef std::tr1::shared_ptr<Class> Shared ## Class; \ typedef std::tr1::shared_ptr<Class> Shared ## Class; \
......
...@@ -16,10 +16,18 @@ ...@@ -16,10 +16,18 @@
* *
* Swizzling has to be defined before the glm.hpp gets first included, no not forget * Swizzling has to be defined before the glm.hpp gets first included, no not forget
* 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!
*
* Pragmas: try to ignore warnings in GLM, so warnings can be activated for ACGL builds
* and the log does not get flooded with GLM warnings that we can't fix anyway with the
* risk of not seeing ACGL warnings.
*/ */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wtype-limits"
#define GLM_SWIZZL #define GLM_SWIZZL
#include <glm/glm.hpp> #include <glm/glm.hpp>
#include <glm/ext.hpp> #include <glm/ext.hpp>
#pragma GCC diagnostic pop
#include <ACGL/Math/Constants.hh> #include <ACGL/Math/Constants.hh>
#include <ACGL/Math/Functions.hh> #include <ACGL/Math/Functions.hh>
......
...@@ -124,12 +124,13 @@ public: ...@@ -124,12 +124,13 @@ public:
openGLRareError(); openGLRareError();
} }
/*
inline void bindAsRenderTarget(GLint _x, GLint _y, GLsizei _w, GLsizei _h, GLenum _type = GL_FRAMEBUFFER) const inline void bindAsRenderTarget(GLint _x, GLint _y, GLsizei _w, GLsizei _h, GLenum _type = GL_FRAMEBUFFER) const
{ {
glBindFramebuffer(_type, mContext); glBindFramebuffer(_type, mContext);
glDrawBuffers(mDrawBuffers, msBuffers); glDrawBuffers(mDrawBuffers, msBuffers);
openGLRareError(); openGLRareError();
} }*/
inline bool isFrameBufferObjectComplete(void) const inline bool isFrameBufferObjectComplete(void) const
{ {
......
...@@ -149,9 +149,9 @@ public: ...@@ -149,9 +149,9 @@ public:
inline void setUniform (const std::string& _nameInShader, const glm::vec3& _v) const { setUniform( getUniformLocation(_nameInShader), _v); } inline void setUniform (const std::string& _nameInShader, const glm::vec3& _v) const { setUniform( getUniformLocation(_nameInShader), _v); }
inline void setUniform (const std::string& _nameInShader, const glm::vec4& _v) const { setUniform( getUniformLocation(_nameInShader), _v); } inline void setUniform (const std::string& _nameInShader, const glm::vec4& _v) const { setUniform( getUniformLocation(_nameInShader), _v); }
inline void setUniform (const std::string& _nameInShader, const glm::mat2& _v, GLboolean _transpose = GL_FALSE) const { setUniform( getUniformLocation(_nameInShader), _v); } inline void setUniform (const std::string& _nameInShader, const glm::mat2& _v, GLboolean _transpose = GL_FALSE) const { setUniform( getUniformLocation(_nameInShader), _v, _transpose ); }
inline void setUniform (const std::string& _nameInShader, const glm::mat3& _v, GLboolean _transpose = GL_FALSE) const { setUniform( getUniformLocation(_nameInShader), _v); } inline void setUniform (const std::string& _nameInShader, const glm::mat3& _v, GLboolean _transpose = GL_FALSE) const { setUniform( getUniformLocation(_nameInShader), _v, _transpose ); }
inline void setUniform (const std::string& _nameInShader, const glm::mat4& _v, GLboolean _transpose = GL_FALSE) const { setUniform( getUniformLocation(_nameInShader), _v); } inline void setUniform (const std::string& _nameInShader, const glm::mat4& _v, GLboolean _transpose = GL_FALSE) const { setUniform( getUniformLocation(_nameInShader), _v, _transpose ); }
inline void setTexture (const std::string& _nameInShader, const ConstSharedTexture& _texture, GLenum _unit = 0) const { setUniform( getUniformLocation(_nameInShader), (GLint) _unit); _texture->bind(_unit); } inline void setTexture (const std::string& _nameInShader, const ConstSharedTexture& _texture, GLenum _unit = 0) const { setUniform( getUniformLocation(_nameInShader), (GLint) _unit); _texture->bind(_unit); }
...@@ -164,9 +164,9 @@ public: ...@@ -164,9 +164,9 @@ public:
inline void setProgramUniform (const std::string& _nameInShader, const glm::vec3& _v) const { setProgramUniform( getUniformLocation(_nameInShader), _v); } inline void setProgramUniform (const std::string& _nameInShader, const glm::vec3& _v) const { setProgramUniform( getUniformLocation(_nameInShader), _v); }
inline void setProgramUniform (const std::string& _nameInShader, const glm::vec4& _v) const { setProgramUniform( getUniformLocation(_nameInShader), _v); } inline void setProgramUniform (const std::string& _nameInShader, const glm::vec4& _v) const { setProgramUniform( getUniformLocation(_nameInShader), _v); }
inline void setProgramUniform (const std::string& _nameInShader, const glm::mat2& _v, GLboolean _transpose = GL_FALSE) const { setProgramUniform( getUniformLocation(_nameInShader), _v); } inline void setProgramUniform (const std::string& _nameInShader, const glm::mat2& _v, GLboolean _transpose = GL_FALSE) const { setProgramUniform( getUniformLocation(_nameInShader), _v, _transpose ); }
inline void setProgramUniform (const std::string& _nameInShader, const glm::mat3& _v, GLboolean _transpose = GL_FALSE) const { setProgramUniform( getUniformLocation(_nameInShader), _v); } inline void setProgramUniform (const std::string& _nameInShader, const glm::mat3& _v, GLboolean _transpose = GL_FALSE) const { setProgramUniform( getUniformLocation(_nameInShader), _v, _transpose ); }
inline void setProgramUniform (const std::string& _nameInShader, const glm::mat4& _v, GLboolean _transpose = GL_FALSE) const { setProgramUniform( getUniformLocation(_nameInShader), _v); } inline void setProgramUniform (const std::string& _nameInShader, const glm::mat4& _v, GLboolean _transpose = GL_FALSE) const { setProgramUniform( getUniformLocation(_nameInShader), _v, _transpose ); }
inline void setProgramTexture (const std::string& _nameInShader, const ConstSharedTexture& _texture, GLenum _unit = 0) const { setProgramUniform( getUniformLocation(_nameInShader), (GLint) _unit); _texture->bind(_unit); } inline void setProgramTexture (const std::string& _nameInShader, const ConstSharedTexture& _texture, GLenum _unit = 0) const { setProgramUniform( getUniformLocation(_nameInShader), (GLint) _unit); _texture->bind(_unit); }
......
...@@ -40,7 +40,7 @@ bool FileOperations::rawData(const std::string& _filename, char*& _pData, long_t ...@@ -40,7 +40,7 @@ bool FileOperations::rawData(const std::string& _filename, char*& _pData, long_t
// copy the file into the buffer: // copy the file into the buffer:
result = fread(_pData, 1, _size, pFile); result = fread(_pData, 1, _size, pFile);
if(result != _size) if ( (long_t)result != _size)
{ {
error() << "Reading error!" << std::endl; error() << "Reading error!" << std::endl;
return false; return false;
......
...@@ -9,6 +9,7 @@ using namespace ACGL::OpenGL; ...@@ -9,6 +9,7 @@ using namespace ACGL::OpenGL;
SharedVertexBufferObject VertexBufferObjectControl::create(void) SharedVertexBufferObject VertexBufferObjectControl::create(void)
{ {
/*
GLenum mode = GL_TRIANGLES; GLenum mode = GL_TRIANGLES;
GLsizei elements = 0; GLsizei elements = 0;
if(mpElementArrayBuffer) if(mpElementArrayBuffer)
...@@ -21,6 +22,7 @@ SharedVertexBufferObject VertexBufferObjectControl::create(void) ...@@ -21,6 +22,7 @@ SharedVertexBufferObject VertexBufferObjectControl::create(void)
mode = mArrayBuffers[0]->getMode(); mode = mArrayBuffers[0]->getMode();
elements = mArrayBuffers[0]->getElements(); elements = mArrayBuffers[0]->getElements();
} }
*/
SharedVertexBufferObject vertexBuffer(new VertexBufferObject()); SharedVertexBufferObject vertexBuffer(new VertexBufferObject());
......
#include "ACGL/OpenGL/EXT_direct_state_access.hh" #include "ACGL/OpenGL/EXT_direct_state_access.hh"
#include <ACGL/OpenGL/Tools.hh> #include <ACGL/OpenGL/Tools.hh>
// not all functions are implemented right now, so ignore warnings about unused parameters
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-variable"
namespace ACGL{ namespace ACGL{
namespace OpenGL{ namespace OpenGL{
...@@ -654,7 +659,7 @@ namespace OpenGL{ ...@@ -654,7 +659,7 @@ namespace OpenGL{
// Note: not all are implemented yet ;-) // Note: not all are implemented yet ;-)
// //
void glBindMultiTextureEMULATION (GLenum texunit, GLenum target, GLuint texture) { ACGL::Utils::error() << "NOT IMPLEMENTED YET" << std::endl; } void glBindMultiTextureEMULATION (GLenum texunit, GLenum target, GLuint texture) { ACGL::Utils::error() << "NOT IMPLEMENTED YET" << std::endl; }
GLenum glCheckNamedFramebufferStatusEMULATION (GLuint framebuffer, GLenum target) { ACGL::Utils::error() << "NOT IMPLEMENTED YET" << std::endl; } GLenum glCheckNamedFramebufferStatusEMULATION (GLuint framebuffer, GLenum target) { ACGL::Utils::error() << "NOT IMPLEMENTED YET" << std::endl; return 0;}
void glClientAttribDefaultEMULATION (GLbitfield mask) { ACGL::Utils::error() << "NOT IMPLEMENTED YET" << std::endl; } void glClientAttribDefaultEMULATION (GLbitfield mask) { ACGL::Utils::error() << "NOT IMPLEMENTED YET" << std::endl; }
void glCompressedTextureImage1DEMULATION (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void* data) { ACGL::Utils::error() << "NOT IMPLEMENTED YET" << std::endl; } void glCompressedTextureImage1DEMULATION (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void* data) { ACGL::Utils::error() << "NOT IMPLEMENTED YET" << std::endl; }
void glCompressedTextureImage2DEMULATION (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data) { ACGL::Utils::error() << "NOT IMPLEMENTED YET" << std::endl; } void glCompressedTextureImage2DEMULATION (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void* data) { ACGL::Utils::error() << "NOT IMPLEMENTED YET" << std::endl; }
...@@ -770,8 +775,8 @@ void glGetVertexArrayIntegeri_vEMULATION (GLuint vaobj, GLuint index, GLenum pna ...@@ -770,8 +775,8 @@ void glGetVertexArrayIntegeri_vEMULATION (GLuint vaobj, GLuint index, GLenum pna
void glGetVertexArrayIntegervEMULATION (GLuint vaobj, GLenum pname, GLint* param) { ACGL::Utils::error() << "NOT IMPLEMENTED YET" << std::endl; } void glGetVertexArrayIntegervEMULATION (GLuint vaobj, GLenum pname, GLint* param) { ACGL::Utils::error() << "NOT IMPLEMENTED YET" << std::endl; }
void glGetVertexArrayPointeri_vEMULATION (GLuint vaobj, GLuint index, GLenum pname, GLvoid** param) { ACGL::Utils::error() << "NOT IMPLEMENTED YET" << std::endl; } void glGetVertexArrayPointeri_vEMULATION (GLuint vaobj, GLuint index, GLenum pname, GLvoid** param) { ACGL::Utils::error() << "NOT IMPLEMENTED YET" << std::endl; }
void glGetVertexArrayPointervEMULATION (GLuint vaobj, GLenum pname, GLvoid** param) { ACGL::Utils::error() << "NOT IMPLEMENTED YET" << std::endl; } void glGetVertexArrayPointervEMULATION (GLuint vaobj, GLenum pname, GLvoid** param) { ACGL::Utils::error() << "NOT IMPLEMENTED YET" << std::endl; }
GLvoid * glMapNamedBufferEMULATION (GLuint buffer, GLenum access) { ACGL::Utils::error() << "NOT IMPLEMENTED YET" << std::endl; } GLvoid * glMapNamedBufferEMULATION (GLuint buffer, GLenum access) { ACGL::Utils::error() << "NOT IMPLEMENTED YET" << std::endl; return NULL; }
GLvoid * glMapNamedBufferRangeEMULATION (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access) { ACGL::Utils::error() << "NOT IMPLEMENTED YET" << std::endl; } GLvoid * glMapNamedBufferRangeEMULATION (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access) { ACGL::Utils::error() << "NOT IMPLEMENTED YET" << std::endl; return NULL; }
...@@ -1211,7 +1216,7 @@ void glTextureRenderbufferEMULATION (GLuint texture, GLenum target, GLuint rende ...@@ -1211,7 +1216,7 @@ void glTextureRenderbufferEMULATION (GLuint texture, GLenum target, GLuint rende
void glTextureSubImage1DEMULATION (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void* pixels) { ACGL::Utils::error() << "NOT IMPLEMENTED YET" << std::endl; } void glTextureSubImage1DEMULATION (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void* pixels) { ACGL::Utils::error() << "NOT IMPLEMENTED YET" << std::endl; }
void glTextureSubImage2DEMULATION (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels) { ACGL::Utils::error() << "NOT IMPLEMENTED YET" << std::endl; } void glTextureSubImage2DEMULATION (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void* pixels) { ACGL::Utils::error() << "NOT IMPLEMENTED YET" << std::endl; }
void glTextureSubImage3DEMULATION (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void* pixels) { ACGL::Utils::error() << "NOT IMPLEMENTED YET" << std::endl; } void glTextureSubImage3DEMULATION (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void* pixels) { ACGL::Utils::error() << "NOT IMPLEMENTED YET" << std::endl; }
GLboolean glUnmapNamedBufferEMULATION (GLuint buffer) { ACGL::Utils::error() << "NOT IMPLEMENTED YET" << std::endl; } GLboolean glUnmapNamedBufferEMULATION (GLuint buffer) { ACGL::Utils::error() << "NOT IMPLEMENTED YET" << std::endl; return GL_FALSE; }
void glVertexArrayColorOffsetEMULATION (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset) { ACGL::Utils::error() << "NOT IMPLEMENTED YET" << std::endl; } void glVertexArrayColorOffsetEMULATION (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset) { ACGL::Utils::error() << "NOT IMPLEMENTED YET" << std::endl; }
void glVertexArrayEdgeFlagOffsetEMULATION (GLuint vaobj, GLuint buffer, GLsizei stride, GLintptr offset) { ACGL::Utils::error() << "NOT IMPLEMENTED YET" << std::endl; } void glVertexArrayEdgeFlagOffsetEMULATION (GLuint vaobj, GLuint buffer, GLsizei stride, GLintptr offset) { ACGL::Utils::error() << "NOT IMPLEMENTED YET" << std::endl; }
void glVertexArrayFogCoordOffsetEMULATION (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset) { ACGL::Utils::error() << "NOT IMPLEMENTED YET" << std::endl; } void glVertexArrayFogCoordOffsetEMULATION (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset) { ACGL::Utils::error() << "NOT IMPLEMENTED YET" << std::endl; }
...@@ -1584,5 +1589,5 @@ void glDisableClientStateiEMULATION (GLenum array, GLuint index) { ...@@ -1584,5 +1589,5 @@ void glDisableClientStateiEMULATION (GLenum array, GLuint index) {
} // ACGL } // ACGL
#pragma GCC diagnostic pop
...@@ -18,8 +18,8 @@ int_t VertexBufferObject::getAttributeIndexByName(const std::string& _name) cons ...@@ -18,8 +18,8 @@ int_t VertexBufferObject::getAttributeIndexByName(const std::string& _name) cons
void VertexBufferObject::validate(void) const void VertexBufferObject::validate(void) const
{ {
int mode = -1; GLenum mode = -1;
int elements = -1; GLsizei elements = -1;
if(mpElementArrayBuffer) if(mpElementArrayBuffer)
{ {
......
...@@ -50,8 +50,8 @@ uint32_t privateGetOpenGLVersion( int _type ) ...@@ -50,8 +50,8 @@ uint32_t privateGetOpenGLVersion( int _type )
OGLmajor = versionString[positionOfFirstDot-1] - '0'; OGLmajor = versionString[positionOfFirstDot-1] - '0';
OGLminor = versionString[positionOfFirstDot+1] - '0'; OGLminor = versionString[positionOfFirstDot+1] - '0';
if (OGLmajor < 0 || OGLmajor > 9) OGLmajor = 0; if (OGLmajor > 9) OGLmajor = 0;
if (OGLminor < 0 || OGLminor > 9) OGLminor = 0; if (OGLminor > 9) OGLminor = 0;
OGLversion = OGLmajor*10 + OGLminor; OGLversion = OGLmajor*10 + OGLminor;
} }
......
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