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
5cc2583a
Commit
5cc2583a
authored
Sep 04, 2011
by
Robert Menzel
Browse files
fixed 2 minor bugs on GLEW less systems, better define names
parent
48e0db85
Changes
6
Hide whitespace changes
Inline
Side-by-side
include/ACGL/OpenGL/EXT_direct_state_access.hh
View file @
5cc2583a
...
...
@@ -10,7 +10,7 @@
*
* can now be expressed as:
*
* glProgramUniform
EXT
( shader, 1.0f );
* glProgramUniform
1f
( shader, 1.0f );
*
* If you forget the glUseProgram, bad things can happen. Also: the bound shader program changed, if
* you want to set a uniform without sideeffects, you'll have to save the currently bound shader,
...
...
@@ -53,12 +53,15 @@ void initDirectStateAccessFunctions();
//
// GLEW defines function pointers for the DSA extension functions, if there is no GLEW we have
// to it our self:
#ifndef USE_GLEW
#ifndef
ACGL_
USE_GLEW
#define GL_PROGRAM_MATRIX_ACGL 0x8E2D
#define GL_TRANSPOSE_PROGRAM_MATRIX_ACGL 0x8E2E
#define GL_PROGRAM_MATRIX_STACK_DEPTH_ACGL 0x8E2F
typedef
ptrdiff_t
GLintptr
;
typedef
ptrdiff_t
GLsizeiptr
;
typedef
void
(
ACGLAPIENTRY
*
PFNGLBINDMULTITEXTUREEXTPROC
)
(
GLenum
texunit
,
GLenum
target
,
GLuint
texture
);
typedef
GLenum
(
ACGLAPIENTRY
*
PFNGLCHECKNAMEDFRAMEBUFFERSTATUSEXTPROC
)
(
GLuint
framebuffer
,
GLenum
target
);
typedef
void
(
ACGLAPIENTRY
*
PFNGLCLIENTATTRIBDEFAULTEXTPROC
)
(
GLbitfield
mask
);
...
...
include/ACGL/OpenGL/GL.hh
View file @
5cc2583a
...
...
@@ -81,13 +81,13 @@
#endif
// always include glew unless on iOS
#define USE_GLEW
#define
ACGL_
USE_GLEW
#if (defined(TARGET_OS_IPHONE) || defined(TARGET_IPHONE_SIMULATOR))
# if (TARGET_OS_IPHONE == 1)
# define PLATFORM_IOS
# define OPENGL_ES
# undef USE_GLEW // no glew support on iOS
# define
ACGL_
OPENGL_ES
# undef
ACGL_
USE_GLEW // no glew support on iOS
# endif
#else
// no iOS device...
...
...
@@ -96,12 +96,12 @@
// maybe maemo or android: first one to program for these plattforms should add
// the correct includes here!
# error UNKNOWN mobile plattform! Dont know what to include!
# define OPENGL_ES
# define
ACGL_
OPENGL_ES
# endif
#endif
// we have allways to include glew first!
#ifdef USE_GLEW
#ifdef
ACGL_
USE_GLEW
#ifdef GLEW_LOCAL_PATH
#include GLEW_LOCAL_PATH
#else
...
...
@@ -111,11 +111,11 @@
#include
<GL/glew.h>
#endif
#endif // !GLEW_LOCAL_PATH
#endif // USE_GLEW
#endif //
ACGL_
USE_GLEW
#if defined(__APPLE__) || defined(MACOSX)
#ifdef OPENGL_ES
#ifdef
ACGL_
OPENGL_ES
#import <OpenGLES/ES1/gl.h>
#import <OpenGLES/ES1/glext.h>
#import <OpenGLES/ES2/gl.h>
...
...
include/ACGL/OpenGL/Objects/FrameBufferObject.hh
View file @
5cc2583a
...
...
@@ -170,7 +170,7 @@ public:
inline
bool
setDepthRenderBuffer
(
const
ConstSharedRenderBuffer
&
_renderBuffer
)
{
glFramebufferRenderbuffer
(
GL_FRAMEBUFFER
,
GL_DEPTH_ATTACHMENT
,
GL_RENDERBUFFER
,
_renderBuffer
->
getContext
());
#ifdef OPENGL_ES
#ifdef
ACGL_
OPENGL_ES
if
(
_renderBuffer
->
getInternalFormat
()
==
GL_DEPTH24_STENCIL8_OES
||
_renderBuffer
->
getInternalFormat
()
==
GL_DEPTH_STENCIL_OES
)
glFramebufferRenderbuffer
(
GL_FRAMEBUFFER
,
GL_STENCIL_ATTACHMENT
,
GL_RENDERBUFFER
,
_renderBuffer
->
getContext
());
...
...
@@ -186,7 +186,7 @@ public:
inline
bool
setDepthTexture
(
const
ConstSharedTexture
&
_texture
)
{
glFramebufferTexture2D
(
GL_FRAMEBUFFER
,
GL_DEPTH_ATTACHMENT
,
_texture
->
getTarget
(),
_texture
->
getContext
(),
0
);
#ifdef OPENGL_ES
#ifdef
ACGL_
OPENGL_ES
if
(
_texture
->
getInternalFormat
()
==
GL_DEPTH24_STENCIL8_OES
||
_texture
->
getInternalFormat
()
==
GL_DEPTH_STENCIL_OES
)
glFramebufferTexture2D
(
GL_FRAMEBUFFER
,
GL_STENCIL_ATTACHMENT
,
_texture
->
getTarget
(),
_texture
->
getContext
(),
0
);
...
...
src/ACGL/ACGL.cc
View file @
5cc2583a
...
...
@@ -16,7 +16,7 @@ bool init(void)
//
// init GLEW
//
#ifdef USE_GLEW
#ifdef
ACGL_
USE_GLEW
glewInit
();
if
(
openGLCriticalErrorOccured
())
{
Utils
::
error
()
<<
"could not init GLEW!"
<<
std
::
endl
;
...
...
src/ACGL/OpenGL/EXT_direct_state_access.cc
View file @
5cc2583a
...
...
@@ -4,7 +4,7 @@
namespace
ACGL
{
namespace
OpenGL
{
#if (defined(OPENGL_ES) && defined(PLATFORM_IOS))
#if (defined(
ACGL_
OPENGL_ES) && defined(PLATFORM_IOS))
void
mapProgramUniformFromEXTiOS
();
#endif
void
mapProgramUniformFromEXT
();
...
...
@@ -16,7 +16,7 @@ void initDirectStateAccessFunctions()
//
// Handle glProgramUniform*() calls
//
# if defined(OPENGL_ES)
# if defined(
ACGL_
OPENGL_ES)
# if ( defined(PLATFORM_IOS) && defined(GL_EXT_separate_shader_objects) )
// iOS >= 5.0 with 2011 hardware should implement the seperate_shader_objects
// extension which provides glProgramUniform*EXT calls
...
...
@@ -32,7 +32,7 @@ void initDirectStateAccessFunctions()
// desktop:
if
(
getOpenGLVersionNumber
()
<
41
)
{
// glUniformProgram*() is part of GL 4.1, so there's nothing to do from 4.1 on
# ifdef USE_GLEW
# ifdef
ACGL_
USE_GLEW
if
(
GLEW_ARB_separate_shader_objects
||
GLEW_EXT_direct_state_access
)
{
mapProgramUniformFromEXT
();
}
else
{
...
...
@@ -47,7 +47,7 @@ void initDirectStateAccessFunctions()
//
// other DSA functions:
//
# ifdef USE_GLEW
# ifdef
ACGL_
USE_GLEW
if
(
GLEW_EXT_direct_state_access
)
{
ACGL
::
Utils
::
debug
()
<<
"native EXT_direct_state_access detected"
<<
std
::
endl
;
}
else
{
...
...
@@ -59,7 +59,7 @@ void initDirectStateAccessFunctions()
# endif
}
#if (defined(OPENGL_ES) && defined(PLATFORM_IOS))
#if (defined(
ACGL_
OPENGL_ES) && defined(PLATFORM_IOS))
// TODO: testing
void
mapProgramUniformFromEXTiOS
()
{
...
...
@@ -387,7 +387,7 @@ void mapDSAFromEMULATION()
}
// OpenGL
}
// ACGL
#ifndef USE_GLEW
#ifndef
ACGL_
USE_GLEW
//
// Without GLEW we use our own pointers:
//
...
...
src/ACGL/OpenGL/Tools.cc
View file @
5cc2583a
...
...
@@ -79,9 +79,9 @@ uint32_t getOpenGLVersionNumber()
const
GLubyte
*
acglErrorString
(
GLenum
_errorCode
)
{
#ifdef
PLATFORM_IOS
#if
n
def
ACGL_USE_GLEW
// no gluErrorString on iOS
// this should only get used on OpenGL ES plattforms, so error strings from the compatibility profile
// this should only get used on OpenGL ES plattforms
or if compiled without GLEW
, so error strings from the compatibility profile
// are ignored. Only 3.2+ Core and ES 2.0+ errors belong here:
if
(
_errorCode
==
GL_INVALID_ENUM
)
{
return
(
GLubyte
*
)
"GL_INVALID_ENUM"
;
}
else
if
(
_errorCode
==
GL_INVALID_VALUE
)
{
return
(
GLubyte
*
)
"GL_INVALID_VALUE"
;
}
...
...
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