Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
acgl
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ACGL
acgl
Commits
9da9cccf
Commit
9da9cccf
authored
Mar 15, 2012
by
Robert Menzel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added UBO constructor to init a UBO for usage with a shader
parent
3d9f4470
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
1 deletion
+12
-1
include/ACGL/OpenGL/Objects/UniformBuffer.hh
include/ACGL/OpenGL/Objects/UniformBuffer.hh
+5
-0
src/ACGL/OpenGL/Objects/UniformBuffer.cc
src/ACGL/OpenGL/Objects/UniformBuffer.cc
+7
-1
No files found.
include/ACGL/OpenGL/Objects/UniformBuffer.hh
View file @
9da9cccf
...
...
@@ -42,6 +42,8 @@
namespace
ACGL
{
namespace
OpenGL
{
class
ShaderProgram
;
class
UniformBuffer
:
public
Buffer
{
// ========================================================================================================= \/
...
...
@@ -56,6 +58,9 @@ public:
:
Buffer
(
_pBuffer
,
GL_UNIFORM_BUFFER
)
{}
//! inits the uniformbuffer to be used with the given shaderprogram, _uboName is the name of this buffer in the shader
UniformBuffer
(
const
ptr
::
shared_ptr
<
ShaderProgram
>
&
_shaderProgram
,
const
std
::
string
&
_uboName
);
// ==================================================================================================== \/
// ============================================================================================ GETTERS \/
// ==================================================================================================== \/
...
...
src/ACGL/OpenGL/Objects/UniformBuffer.cc
View file @
9da9cccf
...
...
@@ -4,12 +4,18 @@
////////////////////////////////////////////////////////////////////////////////
#include <ACGL/OpenGL/Objects/UniformBuffer.hh>
#include <ACGL/OpenGL/Objects/ShaderProgram.hh>
using
namespace
ACGL
;
using
namespace
ACGL
::
OpenGL
;
#if (ACGL_OPENGL_VERSION >= 31)
UniformBuffer
::
UniformBuffer
(
const
ptr
::
shared_ptr
<
ShaderProgram
>
&
_shaderProgram
,
const
std
::
string
&
_uboName
)
:
Buffer
(
GL_UNIFORM_BUFFER
)
{
reserveMemory
(
_shaderProgram
->
getUniformBlockSize
(
_uboName
)
);
setUniformOffsets
(
_shaderProgram
->
getUniformOffsetsOfBlock
(
_uboName
)
);
// to enable intuitive setUniform functions
bindBufferBase
(
_shaderProgram
->
getUniformBlockBinding
(
_uboName
)
);
// bind the UBO to the binding point where the shader expects it
}
#endif // OpenGL 3.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