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
89eede10
Commit
89eede10
authored
Feb 07, 2012
by
Robert Menzel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
basic version of ProgramPipelines added
parent
08cb0ef2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
128 additions
and
1 deletion
+128
-1
include/ACGL/OpenGL/Objects.hh
include/ACGL/OpenGL/Objects.hh
+2
-1
include/ACGL/OpenGL/Objects/ProgramPipeline.hh
include/ACGL/OpenGL/Objects/ProgramPipeline.hh
+89
-0
include/ACGL/OpenGL/Objects/ShaderProgram.hh
include/ACGL/OpenGL/Objects/ShaderProgram.hh
+8
-0
src/ACGL/OpenGL/Objects/ProgramPipeline.cc
src/ACGL/OpenGL/Objects/ProgramPipeline.cc
+29
-0
No files found.
include/ACGL/OpenGL/Objects.hh
View file @
89eede10
////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2011,
Computer Graphics Group RWTH Aachen University
//
// Copyright (c) 2011,
2012 Computer Graphics Group RWTH Aachen University
//
// All rights reserved. //
////////////////////////////////////////////////////////////////////////////////
...
...
@@ -20,6 +20,7 @@
#include <ACGL/OpenGL/Objects/RenderObject.hh>
#include <ACGL/OpenGL/Objects/Shader.hh>
#include <ACGL/OpenGL/Objects/ShaderProgram.hh>
#include <ACGL/OpenGL/Objects/ProgramPipeline.hh>
#include <ACGL/OpenGL/Objects/ShaderProgramObject.hh>
#include <ACGL/OpenGL/Objects/Texture.hh>
#include <ACGL/OpenGL/Objects/Sampler.hh>
...
...
include/ACGL/OpenGL/Objects/ProgramPipeline.hh
0 → 100644
View file @
89eede10
////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2012, Computer Graphics Group RWTH Aachen University //
// All rights reserved. //
////////////////////////////////////////////////////////////////////////////////
#ifndef ACGL_OPENGL_OBJECTS_PROGRAMPIPELINE_HH
#define ACGL_OPENGL_OBJECTS_PROGRAMPIPELINE_HH
#include <ACGL/ACGL.hh>
#include <ACGL/Base/Macros.hh>
#include <ACGL/OpenGL/GL.hh>
#include <ACGL/OpenGL/Tools.hh>
#include <ACGL/OpenGL/Objects/ShaderProgram.hh>
namespace
ACGL
{
namespace
OpenGL
{
/**
* OpenGL ProgramPipeline Objects
*
* Multiple ShaderPrograms that are set to be separable can be attached to one ProgramPipeline.
* Uniforms are still a ShaderProgram (not ProgramPipeline) state, so to update them you either have to
* select the correct ShaderProgram first (glActiveShaderProgram) or use the setProgramUniform variants.
*
* When using multiple ShaderPrograms in one ProgramPipeline the varyings don't just match based on
* the names any more, look up "Shader Interface Matching", cry, and rethink whether you still want to
* play around with ProgramPipeline Objects.
*/
#if (ACGL_OPENGL_VERSION >= 41)
class
ProgramPipeline
{
ACGL_NOT_COPYABLE
(
ProgramPipeline
)
public:
ProgramPipeline
();
~
ProgramPipeline
(
void
);
// ==================================================================================================== \/
// ============================================================================================ GETTERS \/
// ==================================================================================================== \/
public:
inline
GLuint
operator
()
(
void
)
const
{
return
mObjectName
;
}
inline
GLuint
getObjectName
(
void
)
const
{
return
mObjectName
;
}
// ===================================================================================================== \/
// ============================================================================================ WRAPPERS \/
// ===================================================================================================== \/
//! Set this ProgramPipeline active, will override active ShaderPrograms!
inline
void
bind
()
const
{
glBindProgramPipeline
(
mObjectName
);
openGLRareError
();
}
//! unbinds the ProgramPipeline (if there is one bound), after that, ShaderPrograms can be used again directly
inline
static
void
unBind
()
{
glBindProgramPipeline
(
0
);
}
//! Sets the given ShaderProgram (that should be part of the ProgramPipeline, which should be active) as target
//! for setUniform() calls. Alternatively use the setProgramUniform calls!
inline
void
setActiveShaderProgram
(
GLuint
_shaderProgram
)
{
glActiveShaderProgram
(
mObjectName
,
_shaderProgram
);
}
//! Sets the given ShaderProgram (that should be part of the ProgramPipeline, which should be active) as target
//! for setUniform() calls. Alternatively use the setProgramUniform calls!
inline
void
setActiveShaderProgram
(
const
SharedShaderProgram
&
_shaderProgram
)
{
glActiveShaderProgram
(
mObjectName
,
_shaderProgram
->
getObjectName
()
);
}
//! _stages is a bitwise OR of GL_TESS_CONTROL_SHADER_BIT, GL_TESS_EVALUATION_SHADER_BIT, GL_VERTEX_SHADER_BIT, GL_GEOMETRY_SHADER_BIT,
//! and/or GL_FRAGMENT_SHADER_BIT _or_ GL_ALL_SHADER_BITS
void
useProgramStages
(
GLbitfield
_stages
,
SharedShaderProgram
_shaderProgram
)
{
if
(
_shaderProgram
)
{
glUseProgramStages
(
mObjectName
,
_stages
,
_shaderProgram
->
getObjectName
()
);
}
else
{
glUseProgramStages
(
mObjectName
,
_stages
,
0
);
// deactivates that part of the pipeline (defined by _stages)
}
}
private:
// TODO: save 5 SharedPointer to the 5 ShaderPrograms for the individual stages
GLuint
mObjectName
;
};
ACGL_SMARTPOINTER_TYPEDEFS
(
ProgramPipeline
)
#endif // OpenGL >= 4.1
}
// OpenGL
}
// ACGL
#endif // ACGL_OPENGL_OBJECTS_PROGRAMPIPELINE_HH
include/ACGL/OpenGL/Objects/ShaderProgram.hh
View file @
89eede10
...
...
@@ -106,6 +106,14 @@ public:
//! link the program, has to be redone after changing input or output locations:
bool
link
(
void
)
const
;
#if (ACGL_OPENGL_VERSION >= 41)
//! set the program separable to be used in a program pipeline object
inline
bool
setSeparable
(
GLboolean
_b
=
GL_TRUE
)
{
glProgramParameteri
(
mObjectName
,
GL_PROGRAM_SEPARABLE
,
_b
);
return
link
();
}
#endif
// ===================================================================================================== \/
// =========================================================================================== LOCATIONS \/
// ===================================================================================================== \/
...
...
src/ACGL/OpenGL/Objects/ProgramPipeline.cc
0 → 100644
View file @
89eede10
////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2012, Computer Graphics Group RWTH Aachen University //
// All rights reserved. //
////////////////////////////////////////////////////////////////////////////////
#include <ACGL/OpenGL/Objects/ProgramPipeline.hh>
using
namespace
ACGL
::
OpenGL
;
#if (ACGL_OPENGL_VERSION >= 41)
ProgramPipeline
::
ProgramPipeline
()
{
glGenProgramPipelines
(
1
,
&
mObjectName
);
if
(
openGLCriticalErrorOccured
()
)
{
ACGL
::
Utils
::
error
()
<<
"could not generate ProgramPipeline!"
<<
std
::
endl
;
mObjectName
=
0
;
return
;
}
}
ProgramPipeline
::~
ProgramPipeline
(
void
)
{
// sampler 0 will get ignored by OpenGL
glDeleteProgramPipelines
(
1
,
&
mObjectName
);
}
#endif // OpenGL >= 4.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