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
546f6ceb
Commit
546f6ceb
authored
Aug 11, 2011
by
Lars Krecklau
Browse files
Merge branch 'master' of
file:///data/git-repository/acgl/libraries/acgl
parents
2a262886
8de2bec9
Changes
13
Hide whitespace changes
Inline
Side-by-side
include/ACGL/Base/Macros.hh
0 → 100644
View file @
546f6ceb
////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2011, Computer Graphics Group RWTH Aachen University //
// All rights reserved. //
////////////////////////////////////////////////////////////////////////////////
#ifndef ACGL_BASE_MACROS_HH
#define ACGL_BASE_MACROS_HH
//Macro to make a class not copyable
#define NOT_COPYABLE(Class) private:\
Class(const Class& other){ }\
void operator=(Class other){ }\
void operator=(Class& other){ }
#endif // MACROS_HH
include/ACGL/OpenGL/Controller/ElementArrayBufferControl.hh
View file @
546f6ceb
...
...
@@ -59,7 +59,7 @@ public:
{
elementArrayBuffer
->
bind
();
elementArrayBuffer
->
setData
(
mpData
,
mElements
);
glBindBuffer
(
GL_ELEMENT_ARRAY_BUFFER
,
0
);
//
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
}
return
elementArrayBuffer
;
}
...
...
include/ACGL/OpenGL/Objects/ArrayBuffer.hh
View file @
546f6ceb
...
...
@@ -20,6 +20,12 @@ namespace OpenGL{
class
ArrayBuffer
{
// ======================================================================================================== \/
// ============================================================================================ GPU CONTEXT \/
// ======================================================================================================== \/
private:
static
GLuint
sArrayBufferContext
;
// ==================================================================================================== \/
// ============================================================================================ STRUCTS \/
// ==================================================================================================== \/
...
...
@@ -123,7 +129,11 @@ public:
//! Bind this buffer
inline
void
bind
(
void
)
const
{
if
(
sArrayBufferContext
==
mContext
)
return
;
glBindBuffer
(
GL_ARRAY_BUFFER
,
mContext
);
sArrayBufferContext
=
mContext
;
}
inline
void
setPointer
(
AttributeVec
::
size_type
_indexInArray
,
GLuint
_indexInShader
)
const
...
...
include/ACGL/OpenGL/Objects/ElementArrayBuffer.hh
View file @
546f6ceb
...
...
@@ -18,6 +18,11 @@ namespace OpenGL{
class
ElementArrayBuffer
{
// ======================================================================================================== \/
// ============================================================================================ GPU CONTEXT \/
// ======================================================================================================== \/
private:
static
GLuint
sElementArrayBufferContext
;
// ========================================================================================================= \/
// ============================================================================================ CONSTRUCTORS \/
// ========================================================================================================= \/
...
...
@@ -77,7 +82,11 @@ public:
//! Bind this buffer
inline
void
bind
(
void
)
const
{
if
(
sElementArrayBufferContext
==
mContext
)
return
;
glBindBuffer
(
GL_ELEMENT_ARRAY_BUFFER
,
mContext
);
sElementArrayBufferContext
=
mContext
;
}
void
draw
(
void
)
const
...
...
include/ACGL/OpenGL/Objects/FrameBuffer.hh
View file @
546f6ceb
...
...
@@ -38,6 +38,12 @@ namespace OpenGL{
class
FrameBuffer
{
// ======================================================================================================== \/
// ============================================================================================ GPU CONTEXT \/
// ======================================================================================================== \/
private:
static
GLuint
sFrameBufferContext
;
// =================================================================================================== \/
// ============================================================================================ STATIC \/
// =================================================================================================== \/
...
...
@@ -125,8 +131,12 @@ public:
*/
inline
void
bind
(
TargetType
_type
=
READ_DRAW_FRAMEBUFFER
)
const
{
if
(
sFrameBufferContext
==
mContext
)
return
;
glBindFramebuffer
(
_type
,
mContext
);
openGLRareError
();
// glBindFramebuffer can only fail if the contect is no valid FBO which shouldn't happen using this framework
sFrameBufferContext
=
mContext
;
}
inline
void
setDrawBuffers
(
void
)
const
...
...
include/ACGL/OpenGL/Objects/ShaderProgram.hh
View file @
546f6ceb
...
...
@@ -22,6 +22,12 @@ namespace OpenGL{
class
ShaderProgram
{
// ======================================================================================================== \/
// ============================================================================================ GPU CONTEXT \/
// ======================================================================================================== \/
private:
static
GLuint
sShaderProgramContext
;
// ===================================================================================================== \/
// ============================================================================================ TYPEDEFS \/
// ===================================================================================================== \/
...
...
@@ -87,7 +93,14 @@ public:
inline
void
setTexture
(
GLint
_location
,
const
SharedTexture
&
_texture
,
GLenum
_unit
=
0
)
const
{
glUniform1i
(
_location
,
_unit
);
_texture
->
bind
(
_unit
);
}
inline
void
use
(
void
)
const
{
glUseProgram
(
mContext
);
}
inline
void
use
(
void
)
const
{
if
(
sShaderProgramContext
==
mContext
)
return
;
glUseProgram
(
mContext
);
sShaderProgramContext
=
mContext
;
}
inline
GLint
getUniformLocation
(
const
char
*
_name
)
const
{
return
glGetUniformLocation
(
mContext
,
_name
);
}
...
...
src/ACGL/OpenGL/Controller/ArrayBufferControl.cc
View file @
546f6ceb
...
...
@@ -23,7 +23,7 @@ SharedArrayBuffer ArrayBufferControl::create(void)
{
arrayBuffer
->
bind
();
arrayBuffer
->
setData
(
mpData
,
mElements
);
glBindBuffer
(
GL_ARRAY_BUFFER
,
0
);
//
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
return
arrayBuffer
;
}
src/ACGL/OpenGL/Controller/VertexBufferControlFileOBJ.cc
View file @
546f6ceb
...
...
@@ -310,10 +310,10 @@ bool VertexBufferControlFileOBJ::loadOBJ(SharedVertexBuffer& _vertexBuffer)
elementArrayBuffer
->
setType
(
indexType
);
elementArrayBuffer
->
bind
();
elementArrayBuffer
->
setData
(
&
indexVector
[
0
],
indexVector
.
size
());
glBindBuffer
(
GL_ELEMENT_ARRAY_BUFFER
,
0
);
//
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
arrayBuffer
->
bind
();
arrayBuffer
->
setData
(
&
interleavedDataVector
[
0
],
index
);
glBindBuffer
(
GL_ARRAY_BUFFER
,
0
);
//
glBindBuffer(GL_ARRAY_BUFFER, 0);
_vertexBuffer
->
setElements
(
indexVector
.
size
());
return
true
;
...
...
src/ACGL/OpenGL/Objects/ArrayBuffer.cc
View file @
546f6ceb
...
...
@@ -8,6 +8,8 @@
using
namespace
ACGL
;
using
namespace
ACGL
::
OpenGL
;
GLuint
ArrayBuffer
::
sArrayBufferContext
=
0
;
int_t
ArrayBuffer
::
getAttributeIndexByName
(
const
std
::
string
&
_nameInArray
)
const
{
for
(
AttributeVec
::
size_type
i
=
0
;
i
<
mAttributes
.
size
();
++
i
)
...
...
@@ -31,5 +33,5 @@ void ArrayBuffer::render(void) const
glDisableVertexAttribArray
(
i
);
openGLRareError
();
}
glBindBuffer
(
GL_ARRAY_BUFFER
,
0
);
//
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
src/ACGL/OpenGL/Objects/ElementArrayBuffer.cc
0 → 100644
View file @
546f6ceb
////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2011, Computer Graphics Group RWTH Aachen University //
// All rights reserved. //
////////////////////////////////////////////////////////////////////////////////
#include
<ACGL/OpenGL/Objects/ElementArrayBuffer.hh>
using
namespace
ACGL
;
using
namespace
ACGL
::
OpenGL
;
GLuint
ElementArrayBuffer
::
sElementArrayBufferContext
=
0
;
src/ACGL/OpenGL/Objects/FrameBuffer.cc
View file @
546f6ceb
...
...
@@ -7,6 +7,8 @@
using
namespace
ACGL
::
OpenGL
;
GLuint
FrameBuffer
::
sFrameBufferContext
=
0
;
/*
* We can't use the constants GL_COLOR_ATTACHMENT1 to GL_COLOR_ATTACHMENT7 here
* because OpenGL ES does not know these yet.
...
...
src/ACGL/OpenGL/Objects/ShaderProgram.cc
View file @
546f6ceb
...
...
@@ -10,6 +10,8 @@ using namespace ACGL::OpenGL;
using
namespace
ACGL
::
Base
;
using
namespace
ACGL
::
Utils
;
GLuint
ShaderProgram
::
sShaderProgramContext
=
0
;
void
ShaderProgram
::
bindAttributeLocations
()
const
{
for
(
SharedShaderVec
::
size_type
i
=
0
;
i
<
mShaders
.
size
();
++
i
)
...
...
src/ACGL/OpenGL/Objects/VertexBuffer.cc
View file @
546f6ceb
...
...
@@ -48,7 +48,9 @@ void VertexBuffer::render(void) const
openGLRareError
();
}
/*
if(mpElementArrayBuffer)
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
*/
}
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