Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ACGL
acgl
Commits
796e8fbe
Commit
796e8fbe
authored
Sep 04, 2013
by
Robert Menzel
Browse files
Merge branch 'khrdebug'
parents
dd9188b9
d25b9f6a
Changes
69
Expand all
Hide whitespace changes
Inline
Side-by-side
include/ACGL/ACGL.hh
View file @
796e8fbe
...
...
@@ -72,8 +72,15 @@
# define CORRECT_PTR_INCLUDES_FOUND
#endif
#if (defined (__clang__))
// newer llvms on MacOS need this version:
# include <memory>
namespace
ptr
=
std
;
# define ACGL_UNIQUE_POINTER_SUPPORTED 1
# define CORRECT_PTR_INCLUDES_FOUND
#endif
#if (!defined(CORRECT_PTR_INCLUDES_FOUND) && ((__GNUC_VERSION__ >= 40400)
|| defined (__clang__)
))
#if (!defined(CORRECT_PTR_INCLUDES_FOUND) && ((__GNUC_VERSION__ >= 40400) ))
// gcc 4.4 or newer without -std=c++0x or clang++
# include <tr1/memory>
namespace
ptr
=
std
::
tr1
;
...
...
@@ -130,14 +137,18 @@ namespace ACGL
/*
* This should get called as soon as a valid OpenGL context exists,
* it will init glew (if used).
* it will init glew (if used)
or the internal GL function loader
.
* Call this before calling any OpenGL functions or OpenGL related
* ACGL stuff.
*
* Returns false if a critical error occured, in that case the ACGL behavior is
* not defined.
*
* parameter forDebugging: if true, register a debug callback for OpenGL and simulate
* a debug context (slow) in case the application is not running in a native debug
* context.
*/
bool
init
();
bool
init
(
bool
forceDebuggingContext
=
true
);
}
...
...
include/ACGL/OpenGL/Creator/ShaderParser.hh
View file @
796e8fbe
...
...
@@ -28,7 +28,7 @@ namespace OpenGL{
*/
class
ShaderParser
{
ACGL_NOT_COPYABLE
(
ShaderParser
)
//
ACGL_NOT_COPYABLE(ShaderParser)
public:
ShaderParser
(
const
std
::
string
&
_filename
);
...
...
include/ACGL/OpenGL/Debug.hh
0 → 100644
View file @
796e8fbe
/***********************************************************************
* Copyright 2013 Computer Graphics Group RWTH Aachen University. *
* All rights reserved. *
* Distributed under the terms of the MIT License (see LICENSE.TXT). *
**********************************************************************/
#pragma once
#include
<ACGL/ACGL.hh>
#include
<ACGL/OpenGL/GL.hh>
namespace
ACGL
{
namespace
OpenGL
{
//! converts a KHR debug source enum to a human readable string
const
char
*
debugSourceName
(
GLenum
_source
);
//! converts a KHR debug type enum to a human readable string
const
char
*
debugTypeName
(
GLenum
_type
);
//! converts a KHR debug severity enum to a human readable string
const
char
*
debugSeverityName
(
GLenum
_type
);
//! tries to register the default debug callback:
//! applications can register alternative callbacks with glDebugMessageCallback !
void
ACGLRegisterDefaultDebugCallback
();
//! default debug callback
void
ACGL_KHR_default_debug_callback
(
GLenum
_source
,
GLenum
_type
,
GLuint
_id
,
GLenum
_severity
,
GLsizei
_length
,
const
GLchar
*
_message
,
const
void
*
_userParam
);
}
// OpenGL
}
// ACGL
include/ACGL/OpenGL/GL.hh
View file @
796e8fbe
...
...
@@ -60,11 +60,6 @@
// To compare the OpenGL version number we define a new ACGL_OPENGL_VERSION XY define here
// analog to ACGL_OPENGL_VERSION_XY
//
// used internally only:
#define ACGL_LATEST_SUPPORTED_OPENGL_VERSION ACGL_OPENGL_VERSION_44
// OpenGL ES 2.0 is the default for embedded:
#ifdef ACGL_OPENGL_ES
# if defined (ACGL_OPENGLES_VERSION_30)
...
...
@@ -130,6 +125,8 @@
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void
CHECKGLERROR
();
#ifdef ACGL_OPENGL_ES
// ES does not know 64bit ints but we need them for the Buffer class:
#include
<stdint.h>
...
...
@@ -190,9 +187,7 @@
// The selection could also be done with some preprocessor magic but it confuses most IDEs.
//
#ifdef ACGL_OPENGL_PROFILE_CORE
#if defined (ACGL_OPENGL_INCLUDE_LATEST_GL) || defined (ACGL_LATEST_SUPPORTED_OPENGL_VERSION)
#include
<ACGL/OpenGL/glloaders/gl_core_43.hh>
#elif defined (ACGL_OPENGL_VERSION_32)
#if defined (ACGL_OPENGL_VERSION_32)
#include
<ACGL/OpenGL/glloaders/gl_core_32.hh>
#elif defined (ACGL_OPENGL_VERSION_33)
#include
<ACGL/OpenGL/glloaders/gl_core_33.hh>
...
...
@@ -209,14 +204,12 @@
#endif
#else
// compatibility profile:
#if defined (ACGL_OPENGL_INCLUDE_LATEST_GL) || defined (ACGL_LATEST_SUPPORTED_OPENGL_VERSION)
#include
<ACGL/OpenGL/glloaders/gl_compatibility_43.hh>
#elif defined (ACGL_OPENGL_VERSION_21)
#include
<ACGL/OpenGL/glloaders/gl_21.hh>
#if defined (ACGL_OPENGL_VERSION_21)
#include
<ACGL/OpenGL/glloaders/gl_compatibility_21.hh>
#elif defined (ACGL_OPENGL_VERSION_30)
#include
<ACGL/OpenGL/glloaders/gl_30.hh>
#include
<ACGL/OpenGL/glloaders/gl_
compatibility_
30.hh>
#elif defined (ACGL_OPENGL_VERSION_31)
#include
<ACGL/OpenGL/glloaders/gl_31.hh>
#include
<ACGL/OpenGL/glloaders/gl_
compatibility_
31.hh>
#elif defined (ACGL_OPENGL_VERSION_32)
#include
<ACGL/OpenGL/glloaders/gl_compatibility_32.hh>
#elif defined (ACGL_OPENGL_VERSION_33)
...
...
include/ACGL/OpenGL/HiLevelObjects/RenderObject.hh
View file @
796e8fbe
...
...
@@ -127,7 +127,6 @@ public:
}
else
if
(
mpFrameBufferObject
)
{
glm
::
uvec3
size
=
mpFrameBufferObject
->
getSize
();
glViewport
(
0
,
0
,
size
.
x
,
size
.
y
);
openGLRareError
();
}
}
...
...
include/ACGL/OpenGL/HiLevelObjects/Viewport.hh
View file @
796e8fbe
...
...
@@ -54,7 +54,7 @@ public:
public:
inline
void
use
(
void
)
const
{
glViewport
(
mOffsetX
,
mOffsetY
,
mWidth
,
mHeight
);
openGLRareError
();
glViewport
(
mOffsetX
,
mOffsetY
,
mWidth
,
mHeight
);
}
inline
void
setOffset
(
GLint
_offsetX
,
GLint
_offsetY
)
...
...
include/ACGL/OpenGL/Objects/Buffer.hh
View file @
796e8fbe
...
...
@@ -44,12 +44,8 @@ class BufferObject {
public:
BufferObject
()
{
mObjectName
=
0
;
glGenBuffers
(
1
,
&
mObjectName
);
if
(
openGLCriticalErrorOccured
()
)
{
ACGL
::
Utils
::
error
()
<<
"could not generate buffer!"
<<
std
::
endl
;
mObjectName
=
0
;
return
;
}
}
~
BufferObject
(
void
)
...
...
@@ -106,7 +102,7 @@ public:
:
mBuffer
(
_pBuffer
),
mTarget
(
_target
)
{
mSize
=
(
mBuffer
==
NULL
)
?
0
:
mBuffer
->
getSize
(
mTarget
);
mSize
=
(
!
mBuffer
)
?
0
:
mBuffer
->
getSize
(
mTarget
);
}
virtual
~
Buffer
(){}
...
...
@@ -124,7 +120,7 @@ public:
// ==================================================================================================== \/
//! the GL buffer can get changed at any time
void
setBufferObject
(
SharedBufferObject
_pBuffer
)
{
mBuffer
=
_pBuffer
;
mSize
=
(
mBuffer
==
NULL
)
?
0
:
mBuffer
->
getSize
(
mTarget
);
}
void
setBufferObject
(
SharedBufferObject
_pBuffer
)
{
mBuffer
=
_pBuffer
;
mSize
=
(
!
mBuffer
)
?
0
:
mBuffer
->
getSize
(
mTarget
);
}
// ===================================================================================================== \/
// ============================================================================================ WRAPPERS \/
...
...
@@ -178,14 +174,12 @@ public:
inline
void
bind
(
GLenum
_target
)
const
{
glBindBuffer
(
_target
,
mBuffer
->
mObjectName
);
openGLRareError
();
}
//! Bind this buffer to its target
inline
void
bind
()
const
{
glBindBuffer
(
mTarget
,
mBuffer
->
mObjectName
);
openGLRareError
();
}
//! Set data for this buffer. Use only to init the buffer!
...
...
@@ -194,7 +188,6 @@ public:
mSize
=
_sizeInBytes
;
bind
(
_target
);
glBufferData
(
_target
,
_sizeInBytes
,
_pData
,
_usage
);
openGLRareError
();
}
//! Set data for this buffer at the last used target. Use only to init the buffer!
...
...
@@ -207,7 +200,6 @@ public:
GLsizeiptr
_sizeInBytes
,
const
GLvoid
*
_pData
)
{
bind
(
_target
);
glBufferSubData
(
_target
,
_offset
,
_sizeInBytes
,
_pData
);
openGLRareError
();
}
//! Use this to modify the buffer
...
...
@@ -228,7 +220,6 @@ public:
GLvoid
*
mapRange
(
GLenum
_target
,
GLintptr
_offset
,
GLsizeiptr
_length
,
GLbitfield
_access
)
{
bind
(
_target
);
GLvoid
*
ret
=
glMapBufferRange
(
_target
,
_offset
,
_length
,
_access
);
openGLRareError
();
return
ret
;
}
...
...
@@ -248,7 +239,6 @@ public:
void
flushMappedRange
(
GLenum
_target
,
GLsizeiptr
_offset
,
GLsizeiptr
_length
)
{
bind
(
_target
);
glFlushMappedBufferRange
(
_target
,
_offset
,
_length
);
openGLRareError
();
}
inline
void
flushMappedRange
(
GLintptr
_offset
,
GLsizeiptr
_length
)
{
...
...
@@ -286,7 +276,6 @@ public:
GLvoid
*
map
(
GLenum
_target
,
GLenum
_access
)
{
bind
(
_target
);
GLvoid
*
ret
=
glMapBuffer
(
_target
,
_access
);
openGLRareError
();
return
ret
;
}
inline
GLvoid
*
map
(
GLenum
_access
)
{
...
...
@@ -296,7 +285,6 @@ public:
GLboolean
unmap
(
GLenum
_target
)
{
bind
(
_target
);
GLboolean
ret
=
glUnmapBuffer
(
_target
);
openGLRareError
();
return
ret
;
}
...
...
include/ACGL/OpenGL/Objects/FrameBufferObject.hh
View file @
796e8fbe
...
...
@@ -89,12 +89,8 @@ public:
mColorAttachments
(),
mDepthAttachment
()
{
mObjectName
=
0
;
glGenFramebuffers
(
1
,
&
mObjectName
);
if
(
openGLCriticalErrorOccured
()
)
{
ACGL
::
Utils
::
error
()
<<
"could not generate FrameBufferObject!"
<<
std
::
endl
;
return
;
}
mDepthAttachment
.
texture
=
ConstSharedTextureBase
();
mDepthAttachment
.
renderBuffer
=
ConstSharedRenderBuffer
();
mDepthAttachment
.
name
=
""
;
// not useful here
...
...
@@ -130,7 +126,6 @@ public:
inline
void
bind
(
GLenum
_type
=
GL_FRAMEBUFFER
)
const
{
glBindFramebuffer
(
_type
,
mObjectName
);
openGLRareError
();
// glBindFramebuffer can only fail if the object name is no valid FBO which shouldn't happen using this framework
}
//! let OpenGL validate the completeness
...
...
include/ACGL/OpenGL/Objects/ProgramPipeline.hh
View file @
796e8fbe
...
...
@@ -51,7 +51,6 @@ public:
inline
void
bind
()
const
{
glBindProgramPipeline
(
mObjectName
);
openGLRareError
();
}
//! unbinds the ProgramPipeline (if there is one bound), after that, ShaderPrograms can be used again directly
...
...
include/ACGL/OpenGL/Objects/RenderBuffer.hh
View file @
796e8fbe
...
...
@@ -40,11 +40,8 @@ public:
mWidth
(
0
),
mHeight
(
0
)
{
mObjectName
=
0
;
glGenRenderbuffers
(
1
,
&
mObjectName
);
if
(
openGLCriticalErrorOccured
()
)
{
ACGL
::
Utils
::
error
()
<<
"could not generate renderbuffer!"
<<
std
::
endl
;
return
;
}
}
virtual
~
RenderBuffer
(
void
)
...
...
include/ACGL/OpenGL/Objects/Sampler.hh
View file @
796e8fbe
...
...
@@ -56,7 +56,6 @@ public:
inline
void
bind
(
GLuint
_textureUnit
)
const
{
glBindSampler
(
_textureUnit
,
mObjectName
);
// yes, no adding of GL_TEXTURE0 !
openGLRareError
();
}
//! unbinds the texture sampler (if there is one bound) from _textureUnit
...
...
include/ACGL/OpenGL/Objects/Shader.hh
View file @
796e8fbe
...
...
@@ -45,7 +45,6 @@ public:
{
mObjectName
=
glCreateShader
(
mType
);
if
(
mObjectName
==
0
)
{
openGLRareError
();
ACGL
::
Utils
::
error
()
<<
"couldn't create Shader object! Requested type = "
<<
(
unsigned
int
)
mType
<<
std
::
endl
;
}
}
...
...
include/ACGL/OpenGL/Objects/ShaderProgram.hh
View file @
796e8fbe
...
...
@@ -130,7 +130,6 @@ public:
inline
void
setUniformBlockBinding
(
const
std
::
string
&
_blockName
,
GLuint
_bindingPoint
)
const
{
GLuint
blockIndex
=
getUniformBlockIndex
(
_blockName
);
if
(
blockIndex
!=
GL_INVALID_INDEX
)
glUniformBlockBinding
(
mObjectName
,
blockIndex
,
_bindingPoint
);
openGLCommonError
();
}
GLint
getUniformBlockBinding
(
const
std
::
string
&
_blockName
)
const
{
return
getUniformBlockBinding
(
getUniformBlockIndex
(
_blockName
));
}
...
...
include/ACGL/OpenGL/Objects/Texture.hh
View file @
796e8fbe
...
...
@@ -73,9 +73,6 @@ public:
mInternalFormat
(
GL_RGBA
)
{
glGenTextures
(
1
,
&
mObjectName
);
if
(
openGLCriticalErrorOccured
()
)
{
ACGL
::
Utils
::
error
()
<<
"could not generate texture!"
<<
std
::
endl
;
}
}
TextureBase
(
GLenum
_target
,
GLenum
_internalFormat
)
...
...
@@ -87,9 +84,6 @@ public:
mInternalFormat
(
_internalFormat
)
{
glGenTextures
(
1
,
&
mObjectName
);
if
(
openGLCriticalErrorOccured
()
)
{
ACGL
::
Utils
::
error
()
<<
"could not generate texture!"
<<
std
::
endl
;
}
}
virtual
~
TextureBase
(
void
)
...
...
@@ -134,14 +128,12 @@ public:
{
glActiveTexture
(
GL_TEXTURE0
+
_textureUnit
);
glBindTexture
(
mTarget
,
mObjectName
);
openGLRareError
();
}
//! Bind this texture to the currently active texture unit.
inline
void
bind
(
void
)
const
{
glBindTexture
(
mTarget
,
mObjectName
);
openGLRareError
();
}
//! sets the minification filter
...
...
include/ACGL/OpenGL/Objects/TextureBuffer.hh
View file @
796e8fbe
...
...
@@ -36,10 +36,8 @@ class TextureBuffer : public Buffer
public:
// create a new BufferObject with _reservedMemory space (in bytes!)
TextureBuffer
(
GLenum
_dataType
,
size_t
_reservedMemory
=
1
)
:
Buffer
(
GL_TEXTURE_BUFFER
)
{
mTextureObjectName
=
0
;
glGenTextures
(
1
,
&
mTextureObjectName
);
if
(
openGLCriticalErrorOccured
()
)
{
ACGL
::
Utils
::
error
()
<<
"could not generate texture object for texture buffer!"
<<
std
::
endl
;
}
mDataType
=
_dataType
;
Buffer
::
setData
(
_reservedMemory
);
attachBufferToTexture
();
...
...
@@ -47,10 +45,8 @@ public:
// use an existing BufferObject
TextureBuffer
(
GLenum
_dataType
,
SharedBufferObject
_pBuffer
)
:
Buffer
(
_pBuffer
,
GL_TEXTURE_BUFFER
)
{
mTextureObjectName
=
0
;
glGenTextures
(
1
,
&
mTextureObjectName
);
if
(
openGLCriticalErrorOccured
()
)
{
ACGL
::
Utils
::
error
()
<<
"could not generate texture object for texture buffer!"
<<
std
::
endl
;
}
mDataType
=
_dataType
;
attachBufferToTexture
();
}
...
...
@@ -75,7 +71,6 @@ public:
void
bindTexture
(
GLuint
_textureUnit
=
0
)
const
{
glActiveTexture
(
GL_TEXTURE0
+
_textureUnit
);
glBindTexture
(
GL_TEXTURE_BUFFER
,
mTextureObjectName
);
openGLRareError
();
}
//! Bind the buffer part to change the data
...
...
@@ -101,7 +96,6 @@ private:
bindTexture
();
glTexBuffer
(
GL_TEXTURE_BUFFER
,
mDataType
,
Buffer
::
getObjectName
()
);
}
openGLCriticalErrorOccured
();
}
GLenum
mDataType
;
...
...
include/ACGL/OpenGL/Objects/VertexArrayObject.hh
View file @
796e8fbe
...
...
@@ -198,15 +198,8 @@ private:
// ===================================================================================================== \/
public:
//! Bind this VAO
//! If error checking is set to common or higher, some consistancy checks are made
#ifdef ACGL_CHECK_COMMON_GL_ERRORS
//! some consistancy checks are made
void
bind
()
const
;
#else
inline
void
bind
()
const
{
glBindVertexArray
(
mObjectName
);
}
#endif
//! Nothing has to be prepared for a render call
inline
void
render
(
void
)
...
...
@@ -219,12 +212,11 @@ public:
//! Will select the matching draw call. Remember to bind() first!
void
draw
(
GLsizei
_primcount
=
1
)
const
{
if
(
mpElementArrayBuffer
)
if
(
mpElementArrayBuffer
)
{
drawElements
(
_primcount
);
else
}
else
{
drawArrays
(
_primcount
);
openGLRareError
();
}
}
// ===================================================================================================== \/
...
...
include/ACGL/OpenGL/Tools.hh
View file @
796e8fbe
...
...
@@ -14,6 +14,7 @@
#include
<ACGL/ACGL.hh>
#include
<ACGL/OpenGL/GL.hh>
#include
<ACGL/OpenGL/Debug.hh>
namespace
ACGL
{
namespace
OpenGL
{
...
...
@@ -161,6 +162,11 @@ const GLubyte* acglErrorString( GLenum _errorCode );
GLenum
openGLError_
(
const
char
*
_fileName
,
const
unsigned
long
_lineNumber
);
/*
* NOTE: Explicit error checks are not needed anymore on desktop systems! Use KHR_debug
* callback instead (ACGL registers a default callback automatically).
*
*
*
* Inside of ACGL we distinguish between rare, common and critical errors. Each kind can be
* switched off which turns the function into nothing after compiler optimization. If an
* error check is turned off it will always behave as if there was no error, even if there
...
...
@@ -223,6 +229,8 @@ inline bool openGLErrorOccuredDummy() { return false; }
# define openGLRareErrorOccured() ACGL::OpenGL::openGLErrorOccuredDummy()
#endif
}
// OpenGL
}
// ACGL
...
...
include/ACGL/OpenGL/glloaders/extensions.hh
View file @
796e8fbe
...
...
@@ -98,6 +98,17 @@ inline bool ACGL_ARB_debug_output() {
#endif
}
// KHR debug (core in OpenGL 4.3) this tests only the extension!
inline
bool
ACGL_KHR_debug
()
{
#ifdef ACGL_EXTENSION_LOADER_GLLOADGEN
return
(
ogl_ext_KHR_debug
!=
ogl_LOAD_FAILED
);
#elif ACGL_EXTENSION_LOADER_GLEW
return
GLEW_KHR_debug
;
#else
return
false
;
#endif
}
}
// OpenGL
}
// ACGL
...
...
include/ACGL/OpenGL/glloaders/gl_21.hh
deleted
100644 → 0
View file @
dd9188b9
This diff is collapsed.
Click to expand it.
include/ACGL/OpenGL/glloaders/gl_30.hh
deleted
100644 → 0
View file @
dd9188b9
This diff is collapsed.
Click to expand it.
Prev
1
2
3
4
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment