OGLplus (0.52.0) a C++ wrapper for OpenGL

NV_copy_image.hpp
Go to the documentation of this file.
1 
12 #pragma once
13 #ifndef OGLPLUS_EXT_NV_COPY_IMAGE_1406270722_HPP
14 #define OGLPLUS_EXT_NV_COPY_IMAGE_1406270722_HPP
15 
16 #if OGLPLUS_DOCUMENTATION_ONLY || GL_NV_copy_image
17 
18 #include <oglplus/object/name.hpp>
19 #include <oglplus/error/object.hpp>
20 #include <oglplus/extension.hpp>
21 
22 namespace oglplus {
23 
25 
32 {
33 private:
34  template <typename SrcObjTag, typename DstObjTag>
35  static void _chk_params(void)
36  {
37  static_assert(
38  std::is_same<SrcObjTag, tag::Texture>() ||
39  std::is_same<SrcObjTag, tag::Renderbuffer>(),
40  "Source object must be a Texture or a Renderbuffer"
41  );
42  static_assert(
43  std::is_same<DstObjTag, tag::Texture>() ||
44  std::is_same<DstObjTag, tag::Renderbuffer>(),
45  "Destination object must be a Texture or a Renderbuffer"
46  );
47  }
48 public:
49  OGLPLUS_EXTENSION_CLASS(NV, copy_image)
50 
51  template <typename SrcObjTag, typename DstObjTag>
52  static void CopyImageSubData(
53  ObjectName<SrcObjTag> src_name,
54  typename ObjBindingOps<SrcObjTag>::Target src_target,
55  GLint src_level,
56  GLint src_x, GLint src_y, GLint src_z,
57  ObjectName<DstObjTag> dst_name,
58  typename ObjBindingOps<DstObjTag>::Target dst_target,
59  GLint dst_level,
60  GLint dst_x, GLint dst_y, GLint dst_z,
61  GLsizei width, GLsizei height, GLsizei depth
62  )
63  {
64  _chk_params<SrcObjTag, DstObjTag>();
65  OGLPLUS_GLFUNC(CopyImageSubDataNV)(
66  GetGLName(src_name),
67  GLenum(src_target),
68  src_level,
69  src_x, src_y, src_z,
70  GetGLName(dst_name),
71  GLenum(dst_target),
72  dst_level,
73  dst_x, dst_y, dst_z,
74  width, height, depth
75  );
76  OGLPLUS_CHECK(
77  CopyImageSubDataNV,
78  ObjectPairError,
79  Subject(dst_name).
80  SubjectBinding(dst_target).
81  Object(src_name).
82  ObjectBinding(src_target)
83  );
84  }
85 
86 #if OGLPLUS_NATIVE_GLX
87  template <typename SrcObjTag, typename DstObjTag>
88  static void CopyImageSubData(
89  const native::ContextGLX& src_context,
90  ObjectName<SrcObjTag> src_name,
91  typename ObjBindingOps<SrcObjTag>::Target src_target,
92  GLint src_level,
93  GLint src_x, GLint src_y, GLint src_z,
94  const native::ContextGLX& dst_context,
95  ObjectName<DstObjTag> dst_name,
96  typename ObjBindingOps<DstObjTag>::Target dst_target,
97  GLint dst_level,
98  GLint dst_x, GLint dst_y, GLint dst_z,
99  GLsizei width, GLsizei height, GLsizei depth
100  )
101  {
102  using native::GetGLXContext;
103 
104  _chk_params<SrcObjTag, DstObjTag>();
105  OGLPLUS_GLXFUNC(CopyImageSubDataNV)(
106  GetGLXDisplay(src_context),
107  GetGLXContext(src_context),
108  GetGLName(src_name),
109  GLenum(src_target),
110  src_level,
111  src_x, src_y, src_z,
112  GetGLXContext(dst_context),
113  GetGLName(dst_name),
114  GLenum(dst_target),
115  dst_level,
116  dst_x, dst_y, dst_z,
117  width, height, depth
118  );
119  OGLPLUS_HANDLE_ERROR_IF(
120  error_code != GL_NO_ERROR,
121  OGLPLUS_GLFUNC(GetError)(),
122  ObjectPairError::Message(error_code),
123  ObjectPairError,
124  Subject(dst_name).
125  SubjectBinding(dst_target).
126  Object(src_name).
127  ObjectBinding(src_target).
128  GLLib_glX().
129  GLFunc("CopyImageSubData")
130  );
131  }
132 #endif // OGLPLUS_NATIVE_GLX
133 
134 #if OGLPLUS_NATIVE_WGL
135  template <typename SrcObjTag, typename DstObjTag>
136  static void CopyImageSubData(
137  const native::ContextWGL& src_context,
138  ObjectName<SrcObjTag> src_name,
139  typename ObjBindingOps<SrcObjTag>::Target src_target,
140  GLint src_level,
141  GLint src_x, GLint src_y, GLint src_z,
142  const native::ContextWGL& dst_context,
143  ObjectName<DstObjTag> dst_name,
144  typename ObjBindingOps<DstObjTag>::Target dst_target,
145  GLint dst_level,
146  GLint dst_x, GLint dst_y, GLint dst_z,
147  GLsizei width, GLsizei height, GLsizei depth
148  )
149  {
150  using native::GetHGLRC;
151 
152  _chk_params<SrcObjTag, DstObjTag>();
153  OGLPLUS_WGLFUNC(CopyImageSubDataNV)(
154  GetHGLRC(src_context),
155  GetGLName(src_name),
156  GLenum(src_target),
157  src_level,
158  src_x, src_y, src_z,
159  GetHGLRC(dst_context),
160  GetGLName(dst_name),
161  GLenum(dst_target),
162  dst_level,
163  dst_x, dst_y, dst_z,
164  width, height, depth
165  );
166  OGLPLUS_HANDLE_ERROR_IF(
167  error_code != GL_NO_ERROR,
168  OGLPLUS_GLFUNC(GetError)(),
169  ObjectPairError::Message(error_code),
170  ObjectPairError,
171  Subject(dst_name).
172  SubjectBinding(dst_target).
173  Object(src_name).
174  ObjectBinding(src_target).
175  GLLib_wgl().
176  GLFunc("CopyImageSubData")
177  );
178  }
179 #endif // OGLPLUS_NATIVE_WGL
180 };
181 
182 } // namespace oglplus
183 
184 #endif // NV_copy_image
185 
186 #endif // include guard
Funcions and classes for handling and wrapping OpenGL extensions.
Wrapper for a valid GLX context handle.
Definition: context_glx.hpp:24
Declaration of OGLplus object-related error.
GLuint GetGLName(ObjectName< ObjTag > named)
Returns the GLuint OpenGL name assigned to named object.
Definition: name.hpp:38
Wrapper for a valid WGL context handle.
Definition: context_wgl.hpp:24
Wrapper for the NV_copy_image extension.
Definition: NV_copy_image.hpp:31
Base class for OpenGL "named" objects.
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).