Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
acgl
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ACGL
acgl
Commits
472edd4d
Commit
472edd4d
authored
Oct 23, 2015
by
Robert Menzel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improved OpenGL ES support
parent
b41d0668
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
199 additions
and
67 deletions
+199
-67
include/ACGL/ACGL.hh
include/ACGL/ACGL.hh
+2
-0
include/ACGL/Base/CompileTimeSettings.hh
include/ACGL/Base/CompileTimeSettings.hh
+0
-2
include/ACGL/Base/OSDetection.hh
include/ACGL/Base/OSDetection.hh
+23
-0
include/ACGL/OpenGL/Debug.hh
include/ACGL/OpenGL/Debug.hh
+21
-1
include/ACGL/OpenGL/GL.hh
include/ACGL/OpenGL/GL.hh
+12
-23
include/ACGL/OpenGL/Objects/Buffer.hh
include/ACGL/OpenGL/Objects/Buffer.hh
+4
-1
include/ACGL/OpenGL/Objects/Query.hh
include/ACGL/OpenGL/Objects/Query.hh
+4
-1
include/ACGL/OpenGL/Objects/Shader.hh
include/ACGL/OpenGL/Objects/Shader.hh
+4
-1
include/ACGL/OpenGL/Objects/ShaderProgram.hh
include/ACGL/OpenGL/Objects/ShaderProgram.hh
+4
-1
include/ACGL/Utils/FileHelpers.hh
include/ACGL/Utils/FileHelpers.hh
+3
-0
include/ACGL/Utils/FileHelpersiOS.h
include/ACGL/Utils/FileHelpersiOS.h
+5
-10
src/ACGL/ACGL.cc
src/ACGL/ACGL.cc
+3
-2
src/ACGL/OpenGL/Creator/ShaderParser.cc
src/ACGL/OpenGL/Creator/ShaderParser.cc
+9
-0
src/ACGL/OpenGL/Debug.cc
src/ACGL/OpenGL/Debug.cc
+13
-1
src/ACGL/OpenGL/Objects/Texture.cc
src/ACGL/OpenGL/Objects/Texture.cc
+54
-7
src/ACGL/OpenGL/Objects/VertexArrayObject.cc
src/ACGL/OpenGL/Objects/VertexArrayObject.cc
+11
-1
src/ACGL/OpenGL/Tools.cc
src/ACGL/OpenGL/Tools.cc
+3
-3
src/ACGL/Utils/FileHelpers.cc
src/ACGL/Utils/FileHelpers.cc
+2
-0
src/ACGL/Utils/FileHelpersiOS.mm
src/ACGL/Utils/FileHelpersiOS.mm
+22
-13
No files found.
include/ACGL/ACGL.hh
View file @
472edd4d
...
...
@@ -7,6 +7,8 @@
#ifndef ACGL_ACGL_HH
#define ACGL_ACGL_HH
#include <ACGL/Base/OSDetection.hh>
/*!
* Include this in all ACGL (header)-files. It will include stuff that is used in
* almost every file:
...
...
include/ACGL/Base/CompileTimeSettings.hh
View file @
472edd4d
...
...
@@ -37,8 +37,6 @@
#define ACGL_DEBUG
#endif
//#error foo
/*
* Map CMake generated error-level defines to internally used, more readable defines
*/
...
...
include/ACGL/Base/OSDetection.hh
0 → 100644
View file @
472edd4d
/***********************************************************************
* Copyright 2015-2015 Computer Graphics Group RWTH Aachen University. *
* All rights reserved. *
* Distributed under the terms of the MIT License (see LICENSE.TXT). *
**********************************************************************/
#pragma once
// Android autodetection:
#ifdef __ANDROID__
# define ACGL_PLATFORM_ANDROID
#endif
// If we're compiling for an Apple system we need this to distinquish between Mac and iOS:
#ifdef __APPLE__
# include <TargetConditionals.h>
#endif
#if (defined(TARGET_OS_IPHONE) || defined(TARGET_IPHONE_SIMULATOR))
# if (TARGET_OS_IPHONE == 1)
# define ACGL_PLATFORM_IOS
# endif
#endif
include/ACGL/OpenGL/Debug.hh
View file @
472edd4d
...
...
@@ -26,7 +26,7 @@ public:
};
#if
def ACGL_OPENGL_DEBUGGER_SUPPORT
#if
(defined(ACGL_OPENGL_DEBUGGER_SUPPORT) && (ACGL_OPENGL_VERSION >= 32))
// only for internal use!
// THE_GL_TYPE has to be:
// GL_BUFFER, GL_SHADER, GL_PROGRAM, GL_VERTEX_ARRAY, GL_QUERY, GL_PROGRAM_PIPELINE,
...
...
@@ -49,6 +49,26 @@ std::string getObjectLabelT( GLuint _objectName )
return
labelName
;
}
#elif (defined(ACGL_OPENGL_DEBUGGER_SUPPORT) && (GL_EXT_debug_label == 1))
// OpenGL ES with extensions:
template
<
unsigned
int
THE_GL_TYPE
>
void
setObjectLabelT
(
GLuint
_objectName
,
const
std
::
string
&
_label
)
{
glLabelObjectEXT
(
THE_GL_TYPE
,
_objectName
,
0
,
_label
.
c_str
()
);
}
template
<
unsigned
int
THE_GL_TYPE
>
std
::
string
getObjectLabelT
(
GLuint
_objectName
)
{
GLsizei
labelLenght
;
glGetObjectLabelEXT
(
THE_GL_TYPE
,
_objectName
,
0
,
&
labelLenght
,
NULL
);
GLchar
*
tmp
=
new
GLchar
[
labelLenght
+
1
];
// +1 to have space for the 0-termination
glGetObjectLabelEXT
(
THE_GL_TYPE
,
_objectName
,
labelLenght
+
1
,
NULL
,
tmp
);
std
::
string
labelName
(
tmp
);
delete
[]
tmp
;
return
labelName
;
}
#endif
//! converts a KHR debug source enum to a human readable string
...
...
include/ACGL/OpenGL/GL.hh
View file @
472edd4d
...
...
@@ -7,6 +7,8 @@
#ifndef ACGL_OPENGL_GL_HH
#define ACGL_OPENGL_GL_HH
#include <ACGL/Base/OSDetection.hh>
/*
* This simple OpenGL wrapper is used to include OpenGL (and if needed GLEW)
* on different platforms.
...
...
@@ -39,22 +41,8 @@
* (full/compatibility profile).
*/
// Android autodetection:
#ifdef __ANDROID__
#if (defined(ACGL_PLATFORM_IOS) || defined(ACGL_PLATFORM_ANDROID))
# define ACGL_OPENGL_ES
# define PLATFORM_ANDROID
#endif
// If we're compiling for an Apple system we need this to distinquish between Mac and iOS:
#ifdef __APPLE__
# include <TargetConditionals.h>
#endif
#if (defined(TARGET_OS_IPHONE) || defined(TARGET_IPHONE_SIMULATOR))
# if (TARGET_OS_IPHONE == 1)
# define ACGL_PLATFORM_IOS
# define ACGL_OPENGL_ES
# endif
#endif
// To compare the OpenGL version number we define a new ACGL_OPENGL_VERSION XY define here
...
...
@@ -130,15 +118,15 @@
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#if ACGL_OPENGL_VERSION > 32
// prevents QT from redefining the debug functions
#define GL_ARB_debug_output
#define GL_KHR_debug
// prevents QT from redefining the debug functions
#define GL_ARB_debug_output
#define GL_KHR_debug
// debug label, debug groups:
#define ACGL_OPENGL_DEBUGGER_SUPPORT
// debug label, debug groups:
#define ACGL_OPENGL_DEBUGGER_SUPPORT
// debug callbacks:
#define ACGL_OPENGL_DEBUG_CALLBACK_SUPPORT
// debug callbacks:
#define ACGL_OPENGL_DEBUG_CALLBACK_SUPPORT
#endif
void
CHECKGLERROR
();
...
...
@@ -158,10 +146,11 @@ void CHECKGLERROR();
#elif defined (ACGL_OPENGLES_VERSION_30)
#import <OpenGLES/ES3/gl.h>
#import <OpenGLES/ES3/glext.h>
#define ACGL_OPENGL_DEBUGGER_SUPPORT
#else
#error "location of ES headers not known"
#endif
#elif defined (PLATFORM_ANDROID)
#elif defined (
ACGL_
PLATFORM_ANDROID)
// Android:
#if defined (ACGL_OPENGLES_VERSION_20)
#include <GLES2/gl2.h>
...
...
include/ACGL/OpenGL/Objects/Buffer.hh
View file @
472edd4d
...
...
@@ -114,9 +114,12 @@ public:
public:
// Sets and gets a label visible inside of a OpenGL debugger if KHR_debug is supported at runtime *and*
// if ACGL_OPENGL_DEBUGGER_SUPPORT was defined during compile time. Does nothing otherwise!
#if
def ACGL_OPENGL_DEBUGGER_SUPPORT
#if
(defined(ACGL_OPENGL_DEBUGGER_SUPPORT) && (ACGL_OPENGL_VERSION >= 32))
void
setObjectLabel
(
const
std
::
string
&
_label
)
{
setObjectLabelT
<
GL_BUFFER
>
(
getObjectName
(),
_label
);
}
std
::
string
getObjectLabel
()
{
return
getObjectLabelT
<
GL_BUFFER
>
(
getObjectName
());
}
#elif (defined(ACGL_OPENGL_DEBUGGER_SUPPORT) && (ACGL_OPENGLES_VERSION >= 10))
void
setObjectLabel
(
const
std
::
string
&
_label
)
{
setObjectLabelT
<
GL_BUFFER_OBJECT_EXT
>
(
getObjectName
(),
_label
);
}
std
::
string
getObjectLabel
()
{
return
getObjectLabelT
<
GL_BUFFER_OBJECT_EXT
>
(
getObjectName
());
}
#else
void
setObjectLabel
(
const
std
::
string
&
)
{}
std
::
string
getObjectLabel
()
{
return
""
;
}
...
...
include/ACGL/OpenGL/Objects/Query.hh
View file @
472edd4d
...
...
@@ -52,9 +52,12 @@ public:
public:
// Sets and gets a label visible inside of a OpenGL debugger if KHR_debug is supported at runtime *and*
// if ACGL_OPENGL_DEBUGGER_SUPPORT was defined during compile time. Does nothing otherwise!
#if
def ACGL_OPENGL_DEBUGGER_SUPPORT
#if
(defined(ACGL_OPENGL_DEBUGGER_SUPPORT) && (ACGL_OPENGL_VERSION >= 32))
void
setObjectLabel
(
const
std
::
string
&
_label
)
{
setObjectLabelT
<
GL_QUERY
>
(
getObjectName
(),
_label
);
}
std
::
string
getObjectLabel
()
{
return
getObjectLabelT
<
GL_QUERY
>
(
getObjectName
());
}
#elif (defined(ACGL_OPENGL_DEBUGGER_SUPPORT) && (ACGL_OPENGLES_VERSION >= 10))
void
setObjectLabel
(
const
std
::
string
&
_label
)
{
setObjectLabelT
<
GL_QUERY_OBJECT_EXT
>
(
getObjectName
(),
_label
);
}
std
::
string
getObjectLabel
()
{
return
getObjectLabelT
<
GL_QUERY_OBJECT_EXT
>
(
getObjectName
());
}
#else
void
setObjectLabel
(
const
std
::
string
&
)
{}
std
::
string
getObjectLabel
()
{
return
""
;
}
...
...
include/ACGL/OpenGL/Objects/Shader.hh
View file @
472edd4d
...
...
@@ -62,9 +62,12 @@ public:
public:
// Sets and gets a label visible inside of a OpenGL debugger if KHR_debug is supported at runtime *and*
// if ACGL_OPENGL_DEBUGGER_SUPPORT was defined during compile time. Does nothing otherwise!
#if
def ACGL_OPENGL_DEBUGGER_SUPPORT
#if
(defined(ACGL_OPENGL_DEBUGGER_SUPPORT) && (ACGL_OPENGL_VERSION >= 32))
void
setObjectLabel
(
const
std
::
string
&
_label
)
{
setObjectLabelT
<
GL_SHADER
>
(
getObjectName
(),
_label
);
}
std
::
string
getObjectLabel
()
{
return
getObjectLabelT
<
GL_SHADER
>
(
getObjectName
());
}
#elif (defined(ACGL_OPENGL_DEBUGGER_SUPPORT) && (ACGL_OPENGLES_VERSION >= 10))
void
setObjectLabel
(
const
std
::
string
&
_label
)
{
setObjectLabelT
<
GL_SHADER_OBJECT_EXT
>
(
getObjectName
(),
_label
);
}
std
::
string
getObjectLabel
()
{
return
getObjectLabelT
<
GL_SHADER_OBJECT_EXT
>
(
getObjectName
());
}
#else
void
setObjectLabel
(
const
std
::
string
&
)
{}
std
::
string
getObjectLabel
()
{
return
""
;
}
...
...
include/ACGL/OpenGL/Objects/ShaderProgram.hh
View file @
472edd4d
...
...
@@ -90,9 +90,12 @@ public:
public:
// Sets and gets a label visible inside of a OpenGL debugger if KHR_debug is supported at runtime *and*
// if ACGL_OPENGL_DEBUGGER_SUPPORT was defined during compile time. Does nothing otherwise!
#if
def ACGL_OPENGL_DEBUGGER_SUPPORT
#if
(defined(ACGL_OPENGL_DEBUGGER_SUPPORT) && (ACGL_OPENGL_VERSION >= 32))
void
setObjectLabel
(
const
std
::
string
&
_label
)
{
setObjectLabelT
<
GL_PROGRAM
>
(
getObjectName
(),
_label
);
}
std
::
string
getObjectLabel
()
{
return
getObjectLabelT
<
GL_PROGRAM
>
(
getObjectName
());
}
#elif (defined(ACGL_OPENGL_DEBUGGER_SUPPORT) && (ACGL_OPENGLES_VERSION >= 10))
void
setObjectLabel
(
const
std
::
string
&
_label
)
{
setObjectLabelT
<
GL_PROGRAM_OBJECT_EXT
>
(
getObjectName
(),
_label
);
}
std
::
string
getObjectLabel
()
{
return
getObjectLabelT
<
GL_PROGRAM_OBJECT_EXT
>
(
getObjectName
());
}
#else
void
setObjectLabel
(
const
std
::
string
&
)
{}
std
::
string
getObjectLabel
()
{
return
""
;
}
...
...
include/ACGL/Utils/FileHelpers.hh
View file @
472edd4d
...
...
@@ -47,6 +47,9 @@ namespace FileHelpers
*/
std
::
string
getDeviceDependentPathFor
(
const
std
::
string
&
resource
);
// resource path is important on iOS, "" everywhere else
std
::
string
getDeviceResourcePath
();
typedef
time_t
FileModificationTime
;
/*
...
...
include/ACGL/Utils/FileHelpersiOS.h
View file @
472edd4d
////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2011, Computer Graphics Group RWTH Aachen University //
// All rights reserved. //
////////////////////////////////////////////////////////////////////////////////
/*
* FileHelpersiOS.h
* iOS-Test
*
*/
/***********************************************************************
* Copyright 2011-2015 Computer Graphics Group RWTH Aachen University. *
* All rights reserved. *
* Distributed under the terms of the MIT License (see LICENSE.TXT). *
**********************************************************************/
src/ACGL/ACGL.cc
View file @
472edd4d
...
...
@@ -46,13 +46,14 @@ bool init( bool forceDebuggingContext )
//
// check OpenGL version
//
Utils
::
debug
()
<<
"OpenGL Version: "
<<
OpenGL
::
getOpenGLMajorVersionNumber
()
<<
"."
<<
OpenGL
::
getOpenGLMinorVersionNumber
()
<<
std
::
endl
;
#ifdef ACGL_OPENGL_ES
Utils
::
debug
()
<<
"OpenGL ES Version: "
;
unsigned
int
versionToTest
=
ACGL_OPENGLES_VERSION
;
#else
Utils
::
debug
()
<<
"OpenGL Version: "
;
unsigned
int
versionToTest
=
ACGL_OPENGL_VERSION
;
#endif
Utils
::
debug
()
<<
OpenGL
::
getOpenGLMajorVersionNumber
()
<<
"."
<<
OpenGL
::
getOpenGLMinorVersionNumber
()
<<
std
::
endl
;
if
(
OpenGL
::
getOpenGLVersionNumber
()
<
versionToTest
)
{
Utils
::
error
()
<<
"At compile time an OpenGL context of version "
<<
versionToTest
...
...
src/ACGL/OpenGL/Creator/ShaderParser.cc
View file @
472edd4d
...
...
@@ -97,9 +97,18 @@ void ShaderParser::parse(const std::string &_filename)
//readin( "./"+path+"/"+file );
readin
(
_filename
);
#ifndef ACGL_OPENGL_ES
if
(
mMaxVersion
>
110
)
{
mSources
[
0
]
=
"#version "
+
StringHelpers
::
toString
(
mMaxVersion
)
+
"
\n
"
;
}
#else
#if (ACGL_OPENGLES_VERSION == 20)
mSources
[
0
]
=
"#version 200 es
\n
"
;
#else
mSources
[
0
]
=
"#version 300 es
\n
"
;
#endif
mSources
[
0
]
=
mSources
[
0
]
+
"#define ACGL_OPENGL_ES
\n
"
;
#endif
}
int
ShaderParser
::
registerSourceFile
(
const
std
::
string
&
_name
)
...
...
src/ACGL/OpenGL/Debug.cc
View file @
472edd4d
...
...
@@ -17,7 +17,8 @@ using namespace ACGL::Utils;
namespace
ACGL
{
namespace
OpenGL
{
#ifdef ACGL_OPENGL_DEBUGGER_SUPPORT
#if (defined(ACGL_OPENGL_DEBUGGER_SUPPORT) && (ACGL_OPENGL_VERSION >= 32))
// desktop with native support
GLDebugAnnotation
::
GLDebugAnnotation
(
const
char
*
_message
)
{
GLuint
messageID
=
0
;
...
...
@@ -29,6 +30,17 @@ GLDebugAnnotation::~GLDebugAnnotation()
glPopDebugGroup
();
}
#elif (defined(ACGL_OPENGL_DEBUGGER_SUPPORT) && (GL_EXT_debug_marker == 1))
// OpenGL ES with extension:
GLDebugAnnotation
::
GLDebugAnnotation
(
const
char
*
_message
)
{
glPushGroupMarkerEXT
(
0
,
_message
);
}
GLDebugAnnotation
::~
GLDebugAnnotation
()
{
glPopGroupMarkerEXT
();
}
#else
GLDebugAnnotation
::
GLDebugAnnotation
(
const
char
*
_message
){}
GLDebugAnnotation
::~
GLDebugAnnotation
(){}
...
...
src/ACGL/OpenGL/Objects/Texture.cc
View file @
472edd4d
...
...
@@ -278,22 +278,26 @@ GLuint TextureBase::bindAndGetOldTexture() const
GLenum
TextureBase
::
getCompatibleFormat
(
GLenum
_internalFormat
)
{
#if ((ACGL_OPENGLES_VERSION >= 30) || (ACGL_OPENGL_VERSION >= 20))
#if ((ACGL_OPENGLES_VERSION >= 20))
if
(
(
_internalFormat
==
GL_ALPHA
)
||
(
_internalFormat
==
GL_RGB
)
||
(
_internalFormat
==
GL_RGBA
)
||
(
_internalFormat
==
GL_LUMINANCE
)
||
(
_internalFormat
==
GL_LUMINANCE_ALPHA
))
{
return
_internalFormat
;
}
else
{
ACGL
::
Utils
::
error
()
<<
"Unsupported format for ES"
<<
std
::
endl
;
}
#else
// Desktop OpenGL
if
(
_internalFormat
==
GL_DEPTH24_STENCIL8
)
{
return
GL_DEPTH_STENCIL
;
}
#endif
if
(
_internalFormat
==
GL_DEPTH_COMPONENT
||
_internalFormat
==
GL_DEPTH_COMPONENT16
#if ((ACGL_OPENGLES_VERSION >= 30) || (ACGL_OPENGL_VERSION >= 20))
||
_internalFormat
==
GL_DEPTH_COMPONENT24
||
_internalFormat
==
GL_DEPTH_COMPONENT32F
#endif
)
{
return
GL_DEPTH_COMPONENT
;
}
#if ((ACGL_OPENGLES_VERSION >= 30) || (ACGL_OPENGL_VERSION >= 20))
if
(
_internalFormat
==
GL_R8I
||
_internalFormat
==
GL_R8UI
||
_internalFormat
==
GL_R16I
...
...
@@ -328,7 +332,7 @@ GLenum TextureBase::getCompatibleFormat( GLenum _internalFormat )
GLenum
TextureBase
::
getCompatibleType
(
GLenum
_internalFormat
)
{
#if (
(ACGL_OPENGLES_VERSION >= 30) || (ACGL_OPENGL_VERSION >= 20)
)
#if (
ACGL_OPENGL_VERSION >= 20
)
if
(
_internalFormat
==
GL_DEPTH24_STENCIL8
)
{
return
GL_UNSIGNED_INT_24_8
;
}
...
...
@@ -360,7 +364,7 @@ GLenum TextureBase::getCompatibleType( GLenum _internalFormat )
}
#endif
// not sure if this works for all formats:
return
GL_BYTE
;
return
GL_
UNSIGNED_
BYTE
;
}
...
...
@@ -738,6 +742,16 @@ void TextureBase::texSubImage1D( const SharedTextureData &_data, GLint _mipmapLe
void
TextureBase
::
texImage2D
(
const
SharedTextureData
&
_data
,
GLint
_mipmapLevel
)
{
#if (ACGL_OPENGLES_VERSION >= 10)
if
(
mInternalFormat
!=
_data
->
getFormat
())
{
ACGL
::
Utils
::
error
()
<<
"On ES the internal and external formats must match, chaning internal format"
<<
std
::
endl
;
mInternalFormat
=
_data
->
getFormat
();
}
if
((
_data
->
getType
()
!=
GL_UNSIGNED_BYTE
)
&&
(
_data
->
getType
()
!=
GL_UNSIGNED_SHORT_5_6_5
)
&&
(
_data
->
getType
()
!=
GL_UNSIGNED_SHORT_4_4_4_4
)
&&
(
_data
->
getType
()
!=
GL_UNSIGNED_SHORT_5_5_5_1
))
{
ACGL
::
Utils
::
error
()
<<
"External type is unsupported on ES, this might fail!"
<<
std
::
endl
;
}
#endif
bind
();
mWidth
=
_data
->
getWidth
();
mHeight
=
_data
->
getHeight
();
...
...
@@ -756,6 +770,17 @@ void TextureBase::texImage2D( const SharedTextureData &_data, GLint _mipmapLevel
void
TextureBase
::
texSubImage2D
(
const
SharedTextureData
&
_data
,
GLint
_mipmapLevel
,
glm
::
uvec2
_offset
)
{
#if (ACGL_OPENGLES_VERSION >= 10)
if
(
mInternalFormat
!=
_data
->
getFormat
())
{
ACGL
::
Utils
::
error
()
<<
"On ES the internal and external formats must match, chaning internal format"
<<
std
::
endl
;
mInternalFormat
=
_data
->
getFormat
();
}
if
((
_data
->
getType
()
!=
GL_UNSIGNED_BYTE
)
&&
(
_data
->
getType
()
!=
GL_UNSIGNED_SHORT_5_6_5
)
&&
(
_data
->
getType
()
!=
GL_UNSIGNED_SHORT_4_4_4_4
)
&&
(
_data
->
getType
()
!=
GL_UNSIGNED_SHORT_5_5_5_1
))
{
ACGL
::
Utils
::
error
()
<<
"External type is unsupported on ES, this might fail!"
<<
std
::
endl
;
}
#endif
bind
();
GLsizei
w
=
std
::
min
(
mWidth
,
_data
->
getWidth
()
);
GLsizei
h
=
std
::
max
(
std
::
min
(
mHeight
,
_data
->
getHeight
()
),
1
);
...
...
@@ -774,6 +799,17 @@ void TextureBase::texSubImage2D( const SharedTextureData &_data, GLint _mipmapLe
#if defined (ACGL_OPENGL_SUPPORTS_TEXTURE_3D)
void
TextureBase
::
texImage3D
(
const
SharedTextureData
&
_data
,
GLint
_mipmapLevel
)
{
#if (ACGL_OPENGLES_VERSION >= 10)
if
(
mInternalFormat
!=
_data
->
getFormat
())
{
ACGL
::
Utils
::
error
()
<<
"On ES the internal and external formats must match, chaning internal format"
<<
std
::
endl
;
mInternalFormat
=
_data
->
getFormat
();
}
if
((
_data
->
getType
()
!=
GL_UNSIGNED_BYTE
)
&&
(
_data
->
getType
()
!=
GL_UNSIGNED_SHORT_5_6_5
)
&&
(
_data
->
getType
()
!=
GL_UNSIGNED_SHORT_4_4_4_4
)
&&
(
_data
->
getType
()
!=
GL_UNSIGNED_SHORT_5_5_5_1
))
{
ACGL
::
Utils
::
error
()
<<
"External type is unsupported on ES, this might fail!"
<<
std
::
endl
;
}
#endif
bind
();
mWidth
=
_data
->
getWidth
();
mHeight
=
_data
->
getHeight
();
...
...
@@ -793,6 +829,17 @@ void TextureBase::texImage3D( const SharedTextureData &_data, GLint _mipmapLevel
void
TextureBase
::
texSubImage3D
(
const
SharedTextureData
&
_data
,
GLint
_mipmapLevel
,
glm
::
uvec3
_offset
)
{
#if (ACGL_OPENGLES_VERSION >= 10)
if
(
mInternalFormat
!=
_data
->
getFormat
())
{
ACGL
::
Utils
::
error
()
<<
"On ES the internal and external formats must match, chaning internal format"
<<
std
::
endl
;
mInternalFormat
=
_data
->
getFormat
();
}
if
((
_data
->
getType
()
!=
GL_UNSIGNED_BYTE
)
&&
(
_data
->
getType
()
!=
GL_UNSIGNED_SHORT_5_6_5
)
&&
(
_data
->
getType
()
!=
GL_UNSIGNED_SHORT_4_4_4_4
)
&&
(
_data
->
getType
()
!=
GL_UNSIGNED_SHORT_5_5_5_1
))
{
ACGL
::
Utils
::
error
()
<<
"External type is unsupported on ES, this might fail!"
<<
std
::
endl
;
}
#endif
bind
();
GLsizei
w
=
std
::
min
(
mWidth
,
_data
->
getWidth
()
);
GLsizei
h
=
std
::
max
(
std
::
min
(
mHeight
,
_data
->
getHeight
()
),
1
);
...
...
src/ACGL/OpenGL/Objects/VertexArrayObject.cc
View file @
472edd4d
...
...
@@ -25,7 +25,7 @@ VertexArrayObject::VertexArrayObject( GLenum _mode ) :
mAttributes
.
resize
(
maxAttributes
);
// reserve probably 16 slots, the size() can now be used to query the MAX_VERTEX_ATTRIBS
}
#if
def ACGL_OPENGL_DEBUGGER_SUPPORT
#if
(defined(ACGL_OPENGL_DEBUGGER_SUPPORT) && (ACGL_OPENGL_VERSION >= 32))
void
VertexArrayObject
::
setObjectLabel
(
const
std
::
string
&
_label
)
{
setObjectLabelT
<
GL_VERTEX_ARRAY
>
(
getObjectName
(),
_label
);
...
...
@@ -35,6 +35,16 @@ std::string VertexArrayObject::getObjectLabel()
{
return
getObjectLabelT
<
GL_VERTEX_ARRAY
>
(
getObjectName
());
}
#elif (defined(ACGL_OPENGL_DEBUGGER_SUPPORT) && (ACGL_OPENGLES_VERSION >= 10))
void
VertexArrayObject
::
setObjectLabel
(
const
std
::
string
&
_label
)
{
setObjectLabelT
<
GL_VERTEX_ARRAY_OBJECT_EXT
>
(
getObjectName
(),
_label
);
}
std
::
string
VertexArrayObject
::
getObjectLabel
()
{
return
getObjectLabelT
<
GL_VERTEX_ARRAY_OBJECT_EXT
>
(
getObjectName
());
}
#else
void
VertexArrayObject
::
setObjectLabel
(
const
std
::
string
&
)
{}
std
::
string
VertexArrayObject
::
getObjectLabel
()
{
return
""
;
}
...
...
src/ACGL/OpenGL/Tools.cc
View file @
472edd4d
...
...
@@ -189,7 +189,7 @@ uint32_t getOpenGLVersionNumber()
bool
doesSupportGeometryShader
()
{
#if defined(ACGL_OPENGL_ES)
#if (ACGL_OPENGL_ES_VERSION < 32)
)
#if (ACGL_OPENGL_ES_VERSION < 32)
return
false
;
#else
return
true
;
...
...
@@ -203,7 +203,7 @@ bool doesSupportGeometryShader()
bool
doesSupportTessellationShader
()
{
#if defined(ACGL_OPENGL_ES)
#if (ACGL_OPENGL_ES_VERSION < 32)
)
#if (ACGL_OPENGL_ES_VERSION < 32)
return
false
;
#else
return
true
;
...
...
@@ -217,7 +217,7 @@ bool doesSupportTessellationShader()
bool
doesSupportComputeShader
()
{
#if defined(ACGL_OPENGL_ES)
#if (ACGL_OPENGL_ES_VERSION < 31)
)
#if (ACGL_OPENGL_ES_VERSION < 31)
return
false
;
#else
return
true
;
...
...
src/ACGL/Utils/FileHelpers.cc
View file @
472edd4d
...
...
@@ -100,6 +100,8 @@ namespace FileHelpers
{
return
resource
;
}
std
::
string
getDeviceResourcePath
()
{
return
""
;}
#endif
...
...
src/ACGL/Utils/FileHelpersiOS.mm
View file @
472edd4d
////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2011, Computer Graphics Group RWTH Aachen University //
// All rights reserved. //
////////////////////////////////////////////////////////////////////////////////
/*
* FileHelpersiOS.c
* iOS-Test
*
*
*/
/***********************************************************************
* Copyright 2011-2015 Computer Graphics Group RWTH Aachen University. *
* All rights reserved. *
* Distributed under the terms of the MIT License (see LICENSE.TXT). *
**********************************************************************/
#include <ACGL/Utils/FileHelpers.hh>
#import <UIKit/UIKit.h>
namespace ACGL{
namespace Utils{
namespace FileHelpers{
std::string getDeviceDependentPathFor( const std::string &resource )
{
NSString *res = [NSString stringWithFormat:@"%s", resource.c_str() ];
NSString *path = [[NSBundle mainBundle] pathForResource: res ofType: nil ];
if (path) {
return std::string( [path cStringUsingEncoding:1]
);
return std::string( [path cStringUsingEncoding:1] );
}
return ""; // file not found
}
std::string getDeviceResourcePath()
{
NSString *path = [[NSBundle mainBundle] resourcePath];
return std::string( [path cStringUsingEncoding:1] )+"/";
}
}
}
}
Write
Preview
Markdown
is supported
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