OGLplus (0.52.0) a C++ wrapper for OpenGL

renderbuffer.hpp
Go to the documentation of this file.
1 
12 #pragma once
13 #ifndef OGLPLUS_DSA_RENDERBUFFER_1107121519_HPP
14 #define OGLPLUS_DSA_RENDERBUFFER_1107121519_HPP
15 
16 #include <oglplus/renderbuffer.hpp>
17 
18 namespace oglplus {
19 
20 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_4_5 || GL_ARB_direct_state_access
21 
22 template <>
23 struct ObjGenTag<tag::DirectState, tag::Renderbuffer>
24 {
25  typedef tag::Create Type;
26 };
27 
29 
32 template <>
33 class ObjectOps<tag::DirectState, tag::Renderbuffer>
34  : public ObjZeroOps<tag::DirectState, tag::Renderbuffer>
35 {
36 protected:
37  ObjectOps(void){ }
38 public:
39  GLint GetIntParam(GLenum query) const;
40 
42 
46  void Storage(
47  PixelDataInternalFormat internalformat,
48  GLsizei width,
49  GLsizei height
50  )
51  {
52  OGLPLUS_GLFUNC(NamedRenderbufferStorage)(
53  _name,
54  GLenum(internalformat),
55  width,
56  height
57  );
58  OGLPLUS_CHECK(
59  NamedRenderbufferStorage,
61  Object(*this).
62  EnumParam(internalformat)
63  );
64  }
65 
67 
71  void Storage(const images::ImageSpec& image_spec);
72 
74 
79  GLsizei samples,
80  PixelDataInternalFormat internalformat,
81  GLsizei width,
82  GLsizei height
83  )
84  {
85  OGLPLUS_GLFUNC(NamedRenderbufferStorageMultisample)(
86  _name,
87  samples,
88  GLenum(internalformat),
89  width,
90  height
91  );
92  OGLPLUS_CHECK(
93  NamedRenderbufferStorageMultisample,
95  Object(*this).
96  EnumParam(internalformat)
97  );
98  }
99 
100 
102 
109  GLsizei Width(void) const
110  {
111  return GLsizei(GetIntParam(GL_RENDERBUFFER_WIDTH));
112  }
113 
115 
122  GLsizei Height(void) const
123  {
124  return GLsizei(GetIntParam(GL_RENDERBUFFER_HEIGHT));
125  }
126 
128 
137  GLsizei RedSize(void) const
138  {
139  return GLsizei(GetIntParam(GL_RENDERBUFFER_RED_SIZE));
140  }
141 
143 
154  GLsizei GreenSize(void) const
155  {
156  return GLsizei(GetIntParam(GL_RENDERBUFFER_GREEN_SIZE));
157  }
158 
160 
171  GLsizei BlueSize(void) const
172  {
173  return GLsizei(GetIntParam(GL_RENDERBUFFER_BLUE_SIZE));
174  }
175 
177 
188  GLsizei AlphaSize(void) const
189  {
190  return GLsizei(GetIntParam(GL_RENDERBUFFER_ALPHA_SIZE));
191  }
192 
194 
205  GLsizei DepthSize(void) const
206  {
207  return GLsizei(GetIntParam(GL_RENDERBUFFER_DEPTH_SIZE));
208  }
209 
211 
222  GLsizei StencilSize(void) const
223  {
224  return GLsizei(GetIntParam(GL_RENDERBUFFER_STENCIL_SIZE));
225  }
226 
228 
233  GLsizei Samples(void) const
234  {
235  return GLsizei(GetIntParam(GL_RENDERBUFFER_SAMPLES));
236  }
237 
239 
245  {
247  GetIntParam(GL_RENDERBUFFER_INTERNAL_FORMAT)
248  );
249  }
250 };
251 
253 typedef ObjectOps<tag::DirectState, tag::Renderbuffer>
255 
256 // syntax-sugar operators
257 
258 // Bind
259 inline DSARenderbufferOps& operator << (
260  DSARenderbufferOps& rbo,
261  RenderbufferTarget target
262 )
263 {
264  rbo.Bind(target);
265  return rbo;
266 }
267 
268 // Storage
269 inline DSARenderbufferOps& operator << (
270  DSARenderbufferOps& rbo,
271  const images::ImageSpec& image_spec
272 )
273 {
274  rbo.Storage(image_spec);
275  return rbo;
276 }
277 
279 
282 typedef Object<DSARenderbufferOps> DSARenderbuffer;
283 
284 #endif // GL_ARB_direct_state_access
285 
286 } // namespace oglplus
287 
288 #if !OGLPLUS_LINK_LIBRARY || defined(OGLPLUS_IMPLEMENTING_LIBRARY)
289 #include <oglplus/dsa/renderbuffer.ipp>
290 #endif // OGLPLUS_LINK_LIBRARY
291 
292 #endif // include guard
GLsizei Height(void) const
Returns the height of the renderbuffer as it was specified by Storage*.
Definition: renderbuffer.hpp:122
GLsizei RedSize(void) const
Returns the size in bits of the renderbuffer's red component.
Definition: renderbuffer.hpp:137
ObjectOps< tag::DirectState, tag::Renderbuffer > DSARenderbufferOps
Renderbuffer operations with direct state access.
Definition: renderbuffer.hpp:254
PixelDataInternalFormat
OpenGL pixel data internal format enumeration.
Definition: pixel_data.hpp:79
void StorageMultisample(GLsizei samples, PixelDataInternalFormat internalformat, GLsizei width, GLsizei height)
Set the renderbuffer multisample storage parameters.
Definition: renderbuffer.hpp:78
PixelDataInternalFormat InternalFormat(void) const
Returns the internal format of the renderbuffer.
Definition: renderbuffer.hpp:244
GLsizei BlueSize(void) const
Returns the size in bits of the renderbuffer's blue component.
Definition: renderbuffer.hpp:171
void Storage(PixelDataInternalFormat internalformat, GLsizei width, GLsizei height)
Set the renderbuffer storage parameters.
Definition: renderbuffer.hpp:46
Implements operations applicable to named (non-zero) objects.
Definition: wrap_tpl.hpp:45
GLsizei AlphaSize(void) const
Returns the size in bits of the renderbuffer's alpha component.
Definition: renderbuffer.hpp:188
RenderbufferTarget
Renderbuffer bind target.
Definition: renderbuffer_target.hpp:24
Object< DSARenderbufferOps > DSARenderbuffer
An oglplus_object encapsulating the OpenGL renderbuffer functionality.
Definition: renderbuffer.hpp:282
Implements operations applicable to any object including object 0 (zero)
Definition: fwd.hpp:157
GLsizei DepthSize(void) const
Returns the size in bits of the renderbuffer's depth component.
Definition: renderbuffer.hpp:205
GLsizei GreenSize(void) const
Returns the size in bits of the renderbuffer's green component.
Definition: renderbuffer.hpp:154
GLsizei StencilSize(void) const
Returns the size in bits of the renderbuffer's stencil component.
Definition: renderbuffer.hpp:222
RENDERBUFFER: The default target.
Exception class for GL object-related errors.
Definition: object.hpp:24
GLsizei Samples(void) const
Returns the number of samples of the renderbuffer.
Definition: renderbuffer.hpp:233
void Bind(Target target=Target::Renderbuffer) const
Binds this renderbuffer to the specified target.
Definition: renderbuffer.hpp:133
Renderbuffer object wrappers.
GLsizei Width(void) const
Returns the width of the renderbuffer as it was specified by Storage*.
Definition: renderbuffer.hpp:109
Class wrapping renderbuffer-related functionality with direct state access.
Definition: renderbuffer.hpp:33

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).