OGLplus (0.52.0) a C++ wrapper for OpenGL

frag_data.hpp
Go to the documentation of this file.
1 
12 #pragma once
13 #ifndef OGLPLUS_FRAG_DATA_1107121519_HPP
14 #define OGLPLUS_FRAG_DATA_1107121519_HPP
15 
16 #include <oglplus/glfunc.hpp>
17 #include <oglplus/string/ref.hpp>
22 
23 #include <cassert>
24 
25 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_3_0
26 
27 namespace oglplus {
28 
29 template <>
30 class ProgVarLocOps<tag::FragData>
31 {
32 private:
33  static const char* MsgGettingInactive(void);
34 protected:
35  static const char* MsgUsingInactive(void);
36 public:
38 
45  static void BindLocation(
46  ProgramName program,
47  FragDataSlot location,
48  StrCRef identifier
49  )
50  {
51  OGLPLUS_GLFUNC(BindFragDataLocation)(
52  GetGLName(program),
53  GLuint(location),
54  identifier.c_str()
55  );
56  OGLPLUS_CHECK(
57  BindFragDataLocation,
58  ProgVarError,
59  Program(program).
60  Identifier(identifier).
61  Index(GLuint(location))
62  );
63  }
64 
66 
73  static GLint GetLocation(
74  ProgramName program,
75  StrCRef identifier,
76  bool active_only
77  )
78  {
79  GLint result = OGLPLUS_GLFUNC(GetFragDataLocation)(
80  GetGLName(program),
81  identifier.c_str()
82  );
83  OGLPLUS_CHECK(
84  GetFragDataLocation,
85  ProgVarError,
86  Program(program).
87  Identifier(identifier)
88  );
89  OGLPLUS_HANDLE_ERROR_IF(
90  active_only && (result < 0),
91  GL_INVALID_OPERATION,
92  MsgGettingInactive(),
93  ProgVarError,
94  Program(program).
95  Identifier(identifier)
96  );
97  return result;
98  }
99 };
100 
101 template <>
102 class ProgVarCommonOps<tag::FragData>
103  : public ProgVarLoc<tag::FragData>
104 {
105 protected:
106  ProgVarCommonOps(FragDataLoc fdloc)
107  : ProgVarLoc<tag::FragData>(fdloc)
108  { }
109 public:
110  void Bind(StrCRef identifier)
111  {
112  BindLocation(
113  this->Program(),
114  this->_location,
115  identifier
116  );
117  }
118 };
119 
121 
126 typedef ProgVar<
127  tag::ImplicitSel,
129  tag::NoTypecheck,
130  void
132 
133 } // namespace oglplus
134 
135 #if !OGLPLUS_LINK_LIBRARY || defined(OGLPLUS_IMPLEMENTING_LIBRARY)
136 #include <oglplus/frag_data.ipp>
137 #endif
138 
139 #endif // GL_VERSION_3_0
140 
141 #endif // include guard
const Char * c_str(void) const
Returns the null-terminated c-string.
Definition: ref_tpl.hpp:200
Program variable wrapper.
Program variable location wrapper.
ProgVarLoc(void)
Default construction.
Definition: location.hpp:55
ProgVar< tag::ImplicitSel, tag::FragData, tag::NoTypecheck, void > FragData
Encapsulates frag data operations.
Definition: frag_data.hpp:131
GLuint GetGLName(ObjectName< ObjTag > named)
Returns the GLuint OpenGL name assigned to named object.
Definition: name.hpp:38
String reference.
String const reference wrapper template.
Definition: ref_tpl.hpp:72
Helper macro for optional checking of availability of GL function.
FragDataSlot object.
Declaration of OGLplus program-variable-related error.

Copyright © 2010-2014 Matúš Chochlík, University of Žilina, Žilina, Slovakia.
<matus.chochlik -at- fri.uniza.sk>
<chochlik -at -gmail.com>
Documentation generated on Mon Sep 22 2014 by Doxygen (version 1.8.6).