OGLplus (0.52.0) a C++ wrapper for OpenGL

pixel_ops.hpp
Go to the documentation of this file.
1 
12 #pragma once
13 #ifndef OGLPLUS_CONTEXT_PIXEL_OPS_1201040722_HPP
14 #define OGLPLUS_CONTEXT_PIXEL_OPS_1201040722_HPP
15 
16 #include <oglplus/glfunc.hpp>
18 #include <oglplus/pixel_data.hpp>
19 #include <oglplus/blit_filter.hpp>
21 #include <oglplus/bitfield.hpp>
22 
23 namespace oglplus {
24 namespace context {
25 
27 
30 class PixelOps
31 {
32 public:
33 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_3_0
34 
39  static void PixelStore(PixelStorageMode parameter, GLfloat value)
40  {
41  OGLPLUS_GLFUNC(PixelStoref)(GLenum(parameter), value);
42  OGLPLUS_CHECK(
43  PixelStoref,
44  Error,
45  EnumParam(parameter)
46  );
47  }
48 
50 
54  static void PixelStore(PixelStorageMode parameter, GLint value)
55  {
56  OGLPLUS_GLFUNC(PixelStorei)(GLenum(parameter), value);
57  OGLPLUS_CHECK(
58  PixelStorei,
59  Error,
60  EnumParam(parameter)
61  );
62  }
63 #endif // GL_VERSION_3_0
64 
66 
70  static void ReadPixels(
71  GLint x,
72  GLint y,
73  GLsizei width,
74  GLsizei height,
75  PixelDataFormat format,
76  PixelDataType type,
77  void* data
78  )
79  {
80  OGLPLUS_GLFUNC(ReadPixels)(
81  x, y,
82  width, height,
83  GLenum(format),
84  GLenum(type),
85  data
86  );
87  OGLPLUS_CHECK(
88  ReadPixels,
89  Error,
90  EnumParam(format)
91  );
92  }
93 
95 
99  static void BlitFramebuffer(
100  GLint srcX0,
101  GLint srcY0,
102  GLint srcX1,
103  GLint srcY1,
104  GLint dstX0,
105  GLint dstY0,
106  GLint dstX1,
107  GLint dstY1,
109  BlitFilter filter
110  )
111  {
112  OGLPLUS_GLFUNC(BlitFramebuffer)(
113  srcX0,
114  srcY0,
115  srcX1,
116  srcY1,
117  dstX0,
118  dstY0,
119  dstX1,
120  dstY1,
121  GLbitfield(mask),
122  GLenum(filter)
123  );
124  OGLPLUS_CHECK_SIMPLE(BlitFramebuffer);
125  }
126 
127 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_4_5 || GL_ARB_direct_state_access
128 
133  static void BlitFramebuffer(
134  FramebufferName read,
135  FramebufferName draw,
136  GLint srcX0,
137  GLint srcY0,
138  GLint srcX1,
139  GLint srcY1,
140  GLint dstX0,
141  GLint dstY0,
142  GLint dstX1,
143  GLint dstY1,
145  BlitFilter filter
146  )
147  {
148  OGLPLUS_GLFUNC(BlitNamedFramebuffer)(
149  GetGLName(read),
150  GetGLName(draw),
151  srcX0,
152  srcY0,
153  srcX1,
154  srcY1,
155  dstX0,
156  dstY0,
157  dstX1,
158  dstY1,
159  GLbitfield(mask),
160  GLenum(filter)
161  );
162  OGLPLUS_CHECK(
163  BlitNamedFramebuffer,
164  ObjectPairError,
165  Subject(read).
166  Object(draw).
167  EnumParam(filter)
168  );
169  }
170 #endif
171 };
172 
173 } // namespace context
174 } // namespace oglplus
175 
176 #endif // include guard
OpenGL bitfield-related helpers.
static void BlitFramebuffer(FramebufferName read, FramebufferName draw, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, Bitfield< oglplus::BufferSelectBit > mask, BlitFilter filter)
Transfers a rectangle of pixels from the read buffer the draw buffer.
Definition: pixel_ops.hpp:133
BlitFilter
Enumeration of blit operation filtering modes.
Definition: blit_filter.hpp:27
static void PixelStore(PixelStorageMode parameter, GLfloat value)
Sets the value of a pixel storage parameter.
Definition: pixel_ops.hpp:39
This template serves as a wrapper for OpenGL bitfields.
Definition: bitfield.hpp:56
GLuint GetGLName(ObjectName< ObjTag > named)
Returns the GLuint OpenGL name assigned to named object.
Definition: name.hpp:38
PixelDataType
OpenGL pixel data type enumeration.
Definition: pixel_data.hpp:29
PixelDataFormat
OpenGL pixel data format enumeration.
Definition: pixel_data.hpp:50
OpenGL pixel storage mode parameter names.
Helper macro for optional checking of availability of GL function.
static void ReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, PixelDataFormat format, PixelDataType type, void *data)
Sets the value of a pixel storage parameter.
Definition: pixel_ops.hpp:70
Pixel data-related declarations.
Enumeration of Blit operation filtering modes.
static void PixelStore(PixelStorageMode parameter, GLint value)
Sets the value of a pixel storage parameter.
Definition: pixel_ops.hpp:54
Wrapper for the pixel storage and transfer operations.
Definition: pixel_ops.hpp:30
static void BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, Bitfield< oglplus::BufferSelectBit > mask, BlitFilter filter)
Transfers a rectangle of pixels from the read buffer the draw buffer.
Definition: pixel_ops.hpp:99
Color, depth or stencil buffer selection bit enumeration.
Exception class for general OpenGL errors.
Definition: basic.hpp:43
PixelStorageMode
Pixel storage mode parameter enumeration.
Definition: pixel_storage_mode.hpp:28
A common template for "named" objects like textures, buffers, etc.
Definition: fwd.hpp:136

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