aboutsummaryrefslogtreecommitdiff
path: root/Gem/develop/include/Gem/Utils/GLUtil.h
diff options
context:
space:
mode:
authorTravis CI <zmoelnig@travis-ci.umlaeute.mur.at>2017-12-06 23:47:39 +0000
committerTravis CI <zmoelnig@travis-ci.umlaeute.mur.at>2017-12-06 23:47:39 +0000
commitc886922cc0b8c32ead0459b581f51ff60fdebbd4 (patch)
tree98c9b3036116ebfefde32c8c278639b767e2d305 /Gem/develop/include/Gem/Utils/GLUtil.h
parentff954ec3b2de3f0bce8aee70680469468896df7d (diff)
Gem 427a3d0e61d61e64e76facfa905c120356383bab osx/x86_64
built 'master:427a3d0e61d61e64e76facfa905c120356383bab' for osx/x86_64
Diffstat (limited to 'Gem/develop/include/Gem/Utils/GLUtil.h')
-rw-r--r--Gem/develop/include/Gem/Utils/GLUtil.h111
1 files changed, 59 insertions, 52 deletions
diff --git a/Gem/develop/include/Gem/Utils/GLUtil.h b/Gem/develop/include/Gem/Utils/GLUtil.h
index 16fa492..15b18c8 100644
--- a/Gem/develop/include/Gem/Utils/GLUtil.h
+++ b/Gem/develop/include/Gem/Utils/GLUtil.h
@@ -30,8 +30,13 @@ struct _symbol;
#include "Gem/Exception.h"
-namespace gem {namespace utils {namespace gl {
-GEM_EXTERN extern GLenum glReportError (bool verbose=true);
+namespace gem
+{
+namespace utils
+{
+namespace gl
+{
+GEM_EXTERN extern GLenum glReportError (bool verbose=true);
GEM_EXTERN extern int getGLdefine(const char *name);
GEM_EXTERN extern int getGLdefine(const struct _symbol *name);
GEM_EXTERN extern int getGLdefine(const struct _atom *name);
@@ -39,62 +44,64 @@ GEM_EXTERN extern int getGLbitfield(int argc, struct _atom *argv);
- /* mapping between GLSL-program IDs and float */
- /* this can also return different IDs for different contexts */
- class GEM_EXTERN GLuintMap {
- public:
- GLuintMap(const std::string&name);
- virtual ~GLuintMap();
- GLuint get(float); // throws GemException
- /* map a GLuint to float; if float is 0, the new mapping is created,
- * else we just update an existing one
- * updating is especially useful with multiple contexts */
- float set(GLuint, float f=0);
+/* mapping between GLSL-program IDs and float */
+/* this can also return different IDs for different contexts */
+class GEM_EXTERN GLuintMap
+{
+public:
+ GLuintMap(const std::string&name);
+ virtual ~GLuintMap();
+ GLuint get(float); // throws GemException
+ /* map a GLuint to float; if float is 0, the new mapping is created,
+ * else we just update an existing one
+ * updating is especially useful with multiple contexts */
+ float set(GLuint, float f=0);
- void del(float);
+ void del(float);
- /* usage:
+ /* usage:
+ mapper=GLuintMap("glsl_program");
+ prog=glCreateProgram();
+ progMapped=mapper.set(prog);
+ // for multi-context, you probably want to have a single float map to multiple
+ // programIDs; you add (or update) an existing mapping with:
+ // progMapped=mapper.set(prog, progMapped));
+ outlet_float(m_out, mapper.get(progMapped));
+
+ // ... somewhere else
+ mapper=GLuintMap("glsl_program");
+ GLuint id = mapper.get(atom_getfloat(ap));
+ */
+
+ /* multi-context:
mapper=GLuintMap("glsl_program");
+ float progF=0;
+ switchContext(A);
prog=glCreateProgram();
- progMapped=mapper.set(prog);
- // for multi-context, you probably want to have a single float map to multiple
- // programIDs; you add (or update) an existing mapping with:
- // progMapped=mapper.set(prog, progMapped));
- outlet_float(m_out, mapper.get(progMapped));
+ progF=mapper.set(prog, progF);
+ print(prog,progF); // "3" "3.1415"
+ switchContext(B);
+ prog=glCreateProgram();
+ progF=mapper.set(prog, progF);
+ print(prog,progF); // "6" "3.1415"
- // ... somewhere else
+ // ...somewhere else
mapper=GLuintMap("glsl_program");
- GLuint id = mapper.get(atom_getfloat(ap));
- */
-
- /* multi-context:
- mapper=GLuintMap("glsl_program");
- float progF=0;
- switchContext(A);
- prog=glCreateProgram();
- progF=mapper.set(prog, progF);
- print(prog,progF); // "3" "3.1415"
- switchContext(B);
- prog=glCreateProgram();
- progF=mapper.set(prog, progF);
- print(prog,progF); // "6" "3.1415"
-
- // ...somewhere else
- mapper=GLuintMap("glsl_program");
- prog=mapper.get(progF);
- print(prog,progF); // "3" "3.1415"
- switchContext(B);
- prog=mapper.get(progF);
- print(prog,progF); // "6" "3.1415"
- */
- private:
- struct PIMPL;
- PIMPL*m_pimpl;
- GLuintMap();
- GLuintMap&operator=(const GLuintMap&);
- };
-};};}; /* namespace */
+ prog=mapper.get(progF);
+ print(prog,progF); // "3" "3.1415"
+ switchContext(B);
+ prog=mapper.get(progF);
+ print(prog,progF); // "6" "3.1415"
+ */
+private:
+ struct PIMPL;
+ PIMPL*m_pimpl;
+ GLuintMap();
+ GLuintMap&operator=(const GLuintMap&);
+};
+};
+};
+}; /* namespace */
#endif // for header file
-