OGLplus (0.52.0) a C++ wrapper for OpenGL

texture.hpp
Go to the documentation of this file.
1 
12 #pragma once
13 #ifndef OGLPLUS_TEXTURE_1107121519_HPP
14 #define OGLPLUS_TEXTURE_1107121519_HPP
15 
16 #include <oglplus/fwd.hpp>
17 #include <oglplus/glfunc.hpp>
18 #include <oglplus/error/object.hpp>
19 #include <oglplus/math/vector.hpp>
23 #include <oglplus/data_type.hpp>
24 #include <oglplus/pixel_data.hpp>
27 #include <oglplus/texture_compare.hpp>
30 #include <oglplus/texture_wrap.hpp>
31 #include <oglplus/texture_unit.hpp>
32 #include <oglplus/one_of.hpp>
33 #include <oglplus/output_data.hpp>
34 #include <oglplus/images/fwd.hpp>
35 #include <cassert>
36 
37 namespace oglplus {
38 
41 
43 
50 template <>
51 class ObjGenDelOps<tag::Texture>
52 {
53 protected:
54  static void Gen(tag::Generate, GLsizei count, GLuint* names)
55  {
56  assert(names != nullptr);
57  OGLPLUS_GLFUNC(GenTextures)(count, names);
58  OGLPLUS_CHECK_SIMPLE(GenTextures);
59  }
60 #if GL_VERSION_4_5 || GL_ARB_direct_state_access
61  static void Gen(
62  tag::Create,
63  GLenum target,
64  GLsizei count,
65  GLuint* names
66  )
67  {
68  assert(names != nullptr);
69  OGLPLUS_GLFUNC(CreateTextures)(target, count, names);
70  OGLPLUS_CHECK_SIMPLE(CreateTextures);
71  }
72 
73  GLenum _type;
74 
75  void Gen(tag::Create create, GLsizei count, GLuint* names)
76  {
77  Gen(create, _type, count, names);
78  }
79 #endif
80 
81  static void Delete(GLsizei count, GLuint* names)
82  {
83  assert(names != nullptr);
84  OGLPLUS_GLFUNC(DeleteTextures)(count, names);
85  OGLPLUS_VERIFY_SIMPLE(DeleteTextures);
86  }
87 
88  static GLboolean IsA(GLuint name)
89  {
90  assert(name != 0);
91  GLboolean result = OGLPLUS_GLFUNC(IsTexture)(name);
92  OGLPLUS_VERIFY_SIMPLE(IsTexture);
93  return result;
94  }
95 };
96 
97 template <>
98 struct ObjectSubtype<tag::Texture>
99 {
100  typedef TextureTarget Type;
101 };
102 
104 template <>
105 class ObjBindingOps<tag::Texture>
106 {
107 private:
108  static GLenum _binding_query(TextureTarget target);
109 protected:
110  static GLuint _binding(TextureTarget target);
111 public:
114 
116 
120  static TextureName Binding(Target target)
121  {
122  return TextureName(_binding(target));
123  }
124 
126 
130  static void Bind(
131  Target target,
132  TextureName texture
133  )
134  {
135  OGLPLUS_GLFUNC(BindTexture)(
136  GLenum(target),
137  GetGLName(texture)
138  );
139  OGLPLUS_VERIFY(
140  BindTexture,
141  ObjectError,
142  Object(texture).
143  BindTarget(target)
144  );
145  }
146 
147 #if OGLPLUS_DOCUMENTATION_ONLY ||GL_VERSION_4_2 ||GL_ARB_shader_image_load_store
148 
154  static void BindImage(
155  ImageUnitSelector unit,
156  TextureName texture,
157  GLint level,
158  bool layered,
159  GLint layer,
160  AccessSpecifier access,
161  ImageUnitFormat format
162  )
163  {
164  OGLPLUS_GLFUNC(BindImageTexture)(
165  GLuint(unit),
166  GetGLName(texture),
167  level,
168  layered? GL_TRUE : GL_FALSE,
169  layer,
170  GLenum(access),
171  GLenum(format)
172  );
173  OGLPLUS_CHECK(
174  BindImageTexture,
175  ObjectError,
176  Object(texture).
177  EnumParam(format).
178  Index(level)
179  );
180  }
181 #endif
182 
183 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_4_4 || GL_ARB_multi_bind
184  static void Bind(
185  GLuint first,
186  GLsizei count,
187  const GLuint* names
188  )
189  {
190  OGLPLUS_GLFUNC(BindTextures)(
191  first,
192  count,
193  names
194  );
195  OGLPLUS_VERIFY_SIMPLE(BindTextures);
196  }
197 
198  static void BindImage(
199  GLuint first,
200  GLsizei count,
201  const GLuint* names
202  )
203  {
204  OGLPLUS_GLFUNC(BindImageTextures)(
205  first,
206  count,
207  names
208  );
209  OGLPLUS_VERIFY_SIMPLE(BindImageTextures);
210  }
211 
213 
220  static void Bind(
221  GLuint first,
222  const Sequence<TextureName>& textures
223  )
224  {
225  Bind(first, GLsizei(textures.size()), GetGLNames(textures));
226  }
227 
229 
236  static void BindImage(
237  GLuint first,
238  const Sequence<TextureName>& textures
239  )
240  {
241  BindImage(
242  first,
243  GLsizei(textures.size()),
244  GetGLNames(textures)
245  );
246  }
247 #endif
248 };
249 
251 
254 template <>
256  : public TextureName
257  , public ObjBindingOps<tag::Texture>
258 {
259 protected:
260  ObjCommonOps(void){ }
261 public:
263 
271  static void Active(TextureUnitSelector index)
272  {
273  OGLPLUS_GLFUNC(ActiveTexture)(
274  GLenum(GL_TEXTURE0 + GLuint(index))
275  );
276  OGLPLUS_VERIFY(
277  ActiveTexture,
278  Error,
279  Index(GLuint(index))
280  );
281  }
282 
284 
291  static GLint Active(void)
292  {
293  GLint result;
294  OGLPLUS_GLFUNC(GetIntegerv)(GL_ACTIVE_TEXTURE, &result);
295  OGLPLUS_VERIFY(
296  GetIntegerv,
297  Error,
298  EnumParam(GLenum(GL_ACTIVE_TEXTURE))
299  );
300  return GL_TEXTURE0 - result;
301  }
302 
304 
314  static Target CubeMapFace(GLuint face)
315  {
316  assert(face <= 5);
317  return Target(GL_TEXTURE_CUBE_MAP_POSITIVE_X+face);
318  }
319 
321 #if OGLPLUS_DOCUMENTATION_ONLY ||GL_VERSION_4_2 ||GL_ARB_shader_image_load_store
323 #endif
324 
326 
330  void Bind(Target target) const
331  {
332  Bind(target, *this);
333  }
334 
335 #if OGLPLUS_DOCUMENTATION_ONLY ||GL_VERSION_4_2 ||GL_ARB_shader_image_load_store
336 
342  void BindImage(
343  ImageUnitSelector unit,
344  GLint level,
345  bool layered,
346  GLint layer,
347  AccessSpecifier access,
348  ImageUnitFormat format
349  ) const
350  {
351  BindImage(unit, *this, level, layered, layer, access, format);
352  }
353 #endif
354 
355 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_4_3
356 
362  void InvalidateImage(GLsizei level)
363  {
364  OGLPLUS_GLFUNC(InvalidateTexImage)(_name, level);
365  OGLPLUS_CHECK(
366  InvalidateTexImage,
367  ObjectError,
368  Object(*this).
369  Index(level)
370  );
371  }
372 
374 
380  GLsizei level,
381  GLint xoffs,
382  GLint yoffs,
383  GLint zoffs,
384  GLsizei width,
385  GLsizei height,
386  GLsizei depth
387  )
388  {
389  OGLPLUS_GLFUNC(InvalidateTexSubImage)(
390  _name,
391  level,
392  xoffs,
393  yoffs,
394  zoffs,
395  width,
396  height,
397  depth
398  );
399  OGLPLUS_CHECK(
400  InvalidateTexSubImage,
401  ObjectError,
402  Object(*this).
403  Index(level)
404  );
405  }
406 #endif
407 
408 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_4_4
409 
415  template <typename GLtype>
417  GLsizei level,
418  PixelDataFormat format,
419  const GLtype* data
420  )
421  {
422  OGLPLUS_GLFUNC(ClearTexImage)(
423  _name,
424  level,
425  GLenum(format),
426  GLenum(GetDataType<GLtype>()),
427  data
428  );
429  OGLPLUS_CHECK(
430  ClearTexImage,
431  ObjectError,
432  Object(*this).
433  Index(level)
434  );
435  }
436 
438 
443  template <typename GLtype>
445  GLsizei level,
446  GLint xoffs,
447  GLint yoffs,
448  GLint zoffs,
449  GLsizei width,
450  GLsizei height,
451  GLsizei depth,
452  PixelDataFormat format,
453  const GLtype* data
454  )
455  {
456  OGLPLUS_GLFUNC(ClearTexImage)(
457  _name,
458  level,
459  xoffs,
460  yoffs,
461  zoffs,
462  width,
463  height,
464  depth,
465  GLenum(format),
466  GLenum(GetDataType<GLtype>()),
467  data
468  );
469  OGLPLUS_CHECK(
470  ClearTexImage,
471  ObjectError,
472  Object(*this).
473  Index(level)
474  );
475  }
476 #endif
477 
478 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_4_3 || GL_ARB_texture_view
479 
485  void View(
486  Target target,
487  TextureName orig_texture,
488  PixelDataInternalFormat internal_format,
489  GLuint min_level,
490  GLuint num_levels,
491  GLuint min_layer,
492  GLuint num_layers
493  )
494  {
495  OGLPLUS_GLFUNC(TextureView)(
496  _name,
497  GLenum(target),
498  GetGLName(orig_texture),
499  GLenum(internal_format),
500  min_level,
501  num_levels,
502  min_layer,
503  num_layers
504  );
505  OGLPLUS_CHECK(
506  TextureView,
507  ObjectError,
508  Object(*this).
509  BindTarget(target)
510  );
511  }
512 #endif
513 };
514 
516 
519 template <>
520 class ObjZeroOps<tag::ExplicitSel, tag::Texture>
521  : public ObjCommonOps<tag::Texture>
522 {
523 protected:
524  ObjZeroOps(void) { }
525 public:
527  struct Property
528  {
531 
534 
537 
540 
543 
546 
547 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_3_3 || GL_ARB_texture_swizzle
550 #endif
551 
554 
556  typedef TextureWrap Wrap;
557 
559  typedef OneOf<
560  GLenum,
561  std::tuple<
562  DataType,
564  >
566  };
567 
568  static GLint GetIntParam(Target target, GLenum query);
569  static GLfloat GetFloatParam(Target target, GLenum query);
570 
571 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_3_0
572  static GLint GetIntParam(Target target, GLint level, GLenum query);
573  static GLfloat GetFloatParam(Target target, GLint level, GLenum query);
574 
576 
584  static GLsizei Width(Target target, GLint level = 0)
585  {
586  return GLsizei(GetIntParam(target, level, GL_TEXTURE_WIDTH));
587  }
588 
590 
598  static GLsizei Height(Target target, GLint level = 0)
599  {
600  return GLsizei(GetIntParam(target, level, GL_TEXTURE_HEIGHT));
601  }
602 
604 
612  static GLsizei Depth(Target target, GLint level = 0)
613  {
614  return GLsizei(GetIntParam(target, level, GL_TEXTURE_DEPTH));
615  }
616 
618 
628  static PixelDataType RedType(Target target, GLint level = 0)
629  {
630  return PixelDataType(GetIntParam(
631  target,
632  level,
633  GL_TEXTURE_RED_TYPE
634  ));
635  }
636 
638 
648  static PixelDataType GreenType(Target target, GLint level = 0)
649  {
650  return PixelDataType(GetIntParam(
651  target,
652  level,
653  GL_TEXTURE_GREEN_TYPE
654  ));
655  }
656 
658 
668  static PixelDataType BlueType(Target target, GLint level = 0)
669  {
670  return PixelDataType(GetIntParam(
671  target,
672  level,
673  GL_TEXTURE_BLUE_TYPE
674  ));
675  }
676 
678 
688  static PixelDataType AlphaType(Target target, GLint level = 0)
689  {
690  return PixelDataType(GetIntParam(
691  target,
692  level,
693  GL_TEXTURE_ALPHA_TYPE
694  ));
695  }
696 
698 
708  static PixelDataType DepthType(Target target, GLint level = 0)
709  {
710  return PixelDataType(GetIntParam(
711  target,
712  level,
713  GL_TEXTURE_DEPTH_TYPE
714  ));
715  }
716 
718 
729  static GLsizei RedSize(Target target, GLint level = 0)
730  {
731  return GLsizei(GetIntParam(
732  target,
733  level,
734  GL_TEXTURE_RED_SIZE
735  ));
736  }
737 
739 
750  static GLsizei GreenSize(Target target, GLint level = 0)
751  {
752  return GLsizei(GetIntParam(
753  target,
754  level,
755  GL_TEXTURE_GREEN_SIZE
756  ));
757  }
758 
760 
771  static GLsizei BlueSize(Target target, GLint level = 0)
772  {
773  return GLsizei(GetIntParam(
774  target,
775  level,
776  GL_TEXTURE_BLUE_SIZE
777  ));
778  }
779 
781 
792  static GLsizei AlphaSize(Target target, GLint level = 0)
793  {
794  return GLsizei(GetIntParam(
795  target,
796  level,
797  GL_TEXTURE_ALPHA_SIZE
798  ));
799  }
800 
802 
813  static GLsizei DepthSize(Target target, GLint level = 0)
814  {
815  return GLsizei(GetIntParam(
816  target,
817  level,
818  GL_TEXTURE_DEPTH_SIZE
819  ));
820  }
821 
823 
834  static GLsizei StencilSize(Target target, GLint level = 0)
835  {
836  return GLsizei(GetIntParam(
837  target,
838  level,
839  GL_TEXTURE_STENCIL_SIZE
840  ));
841  }
842 
844 
856  static GLsizei SharedSize(Target target, GLint level = 0)
857  {
858  return GLsizei(GetIntParam(
859  target,
860  level,
861  GL_TEXTURE_SHARED_SIZE
862  ));
863  }
864 
866 
871  static GLsizei CompressedImageSize(Target target, GLint level = 0)
872  {
873  return GLsizei(GetIntParam(
874  target,
875  level,
876  GL_TEXTURE_COMPRESSED_IMAGE_SIZE
877  ));
878  }
879 
881 
887  Target target,
888  GLint level = 0
889  )
890  {
891  return PixelDataInternalFormat(GetIntParam(
892  target,
893  level,
894  GL_TEXTURE_INTERNAL_FORMAT
895  ));
896  }
897 
899 
913  static void GetImage(
914  Target target,
915  GLint level,
916  PixelDataFormat format,
917  const OutputData& dest
918  );
919 
921 
935  static void GetImage(
936  Target target,
937  GLint level,
938  PixelDataFormat format,
940  GLsizei size,
941  GLvoid* buffer
942  )
943  {
944  GetImage(target, level, format, OutputData(type, size, buffer));
945  }
946 
948 
957  static void GetCompressedImage(
958  Target target,
959  GLint level,
960  const OutputData& dest
961  );
962 
964 
973  static void GetCompressedImage(
974  Target target,
975  GLint level,
976  GLsizei size,
977  GLubyte* buffer
978  )
979  {
980  GetCompressedImage(target, level, OutputData(size, buffer));
981  }
982 
984 
993  static void GetCompressedImage(
994  Target target,
995  GLint level,
996  std::vector<GLubyte>& dest
997  );
998 #endif // GL_VERSION_3_0
999 
1001 
1005  static void Image3D(
1006  Target target,
1007  GLint level,
1008  PixelDataInternalFormat internal_format,
1009  GLsizei width,
1010  GLsizei height,
1011  GLsizei depth,
1012  GLint border,
1013  PixelDataFormat format,
1014  Property::PixDataType type,
1015  const void* data
1016  )
1017  {
1018  OGLPLUS_GLFUNC(TexImage3D)(
1019  GLenum(target),
1020  level,
1021  GLint(internal_format),
1022  width,
1023  height,
1024  depth,
1025  border,
1026  GLenum(format),
1027  GLenum(type),
1028  data
1029  );
1030  OGLPLUS_CHECK(
1031  TexImage3D,
1032  ObjectError,
1033  ObjectBinding(target).
1034  EnumParam(internal_format).
1035  Index(level)
1036  );
1037  }
1038 
1040 
1044  static void Image3D(
1045  Target target,
1046  const images::Image& image,
1047  GLint level = 0,
1048  GLint border = 0
1049  );
1050 
1052 
1056  static void SubImage3D(
1057  Target target,
1058  GLint level,
1059  GLint xoffs,
1060  GLint yoffs,
1061  GLint zoffs,
1062  GLsizei width,
1063  GLsizei height,
1064  GLsizei depth,
1065  PixelDataFormat format,
1066  Property::PixDataType type,
1067  const void* data
1068  )
1069  {
1070  OGLPLUS_GLFUNC(TexSubImage3D)(
1071  GLenum(target),
1072  level,
1073  xoffs,
1074  yoffs,
1075  zoffs,
1076  width,
1077  height,
1078  depth,
1079  GLenum(format),
1080  GLenum(type),
1081  data
1082  );
1083  OGLPLUS_CHECK(
1084  TexSubImage3D,
1085  ObjectError,
1086  ObjectBinding(target).
1087  EnumParam(format).
1088  Index(level)
1089  );
1090  }
1091 
1093 
1097  static void SubImage3D(
1098  Target target,
1099  const images::Image& image,
1100  GLint xoffs,
1101  GLint yoffs,
1102  GLint zoffs,
1103  GLint level = 0
1104  );
1105 
1107 
1111  static void Image2D(
1112  Target target,
1113  GLint level,
1114  PixelDataInternalFormat internal_format,
1115  GLsizei width,
1116  GLsizei height,
1117  GLint border,
1118  PixelDataFormat format,
1119  Property::PixDataType type,
1120  const void* data
1121  )
1122  {
1123  OGLPLUS_GLFUNC(TexImage2D)(
1124  GLenum(target),
1125  level,
1126  GLint(internal_format),
1127  width,
1128  height,
1129  border,
1130  GLenum(format),
1131  GLenum(type),
1132  data
1133  );
1134  OGLPLUS_CHECK(
1135  TexImage2D,
1136  ObjectError,
1137  ObjectBinding(target).
1138  EnumParam(internal_format).
1139  Index(level)
1140  );
1141  }
1142 
1144 
1148  static void Image2D(
1149  Target target,
1150  const images::Image& image,
1151  GLint level = 0,
1152  GLint border = 0
1153  );
1154 
1156 
1168  static void ImageCM(
1169  GLuint face,
1170  GLint level,
1171  PixelDataInternalFormat internal_format,
1172  GLsizei width,
1173  GLsizei height,
1174  GLint border,
1175  PixelDataFormat format,
1176  Property::PixDataType type,
1177  const void* data
1178  )
1179  {
1180  assert(face <= 5);
1181  Target target = Target(GL_TEXTURE_CUBE_MAP_POSITIVE_X+face);
1182  OGLPLUS_GLFUNC(TexImage2D)(
1183  GLenum(target),
1184  level,
1185  GLint(internal_format),
1186  width,
1187  height,
1188  border,
1189  GLenum(format),
1190  GLenum(type),
1191  data
1192  );
1193  OGLPLUS_CHECK(
1194  TexImage2D,
1195  ObjectError,
1196  ObjectBinding(target).
1197  EnumParam(format).
1198  Index(level)
1199  );
1200  }
1201 
1203 
1215  static void ImageCM(
1216  GLuint face,
1217  const images::Image& image,
1218  GLint level = 0,
1219  GLint border = 0
1220  );
1221 
1223 
1227  static void SubImage2D(
1228  Target target,
1229  GLint level,
1230  GLint xoffs,
1231  GLint yoffs,
1232  GLsizei width,
1233  GLsizei height,
1234  PixelDataFormat format,
1235  Property::PixDataType type,
1236  const void* data
1237  )
1238  {
1239  OGLPLUS_GLFUNC(TexSubImage2D)(
1240  GLenum(target),
1241  level,
1242  xoffs,
1243  yoffs,
1244  width,
1245  height,
1246  GLenum(format),
1247  GLenum(type),
1248  data
1249  );
1250  OGLPLUS_CHECK(
1251  TexSubImage2D,
1252  ObjectError,
1253  ObjectBinding(target).
1254  EnumParam(format).
1255  Index(level)
1256  );
1257  }
1258 
1260 
1264  static void SubImage2D(
1265  Target target,
1266  const images::Image& image,
1267  GLint xoffs,
1268  GLint yoffs,
1269  GLint level = 0
1270  );
1271 
1272 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_3_0
1273 
1278  static void Image1D(
1279  Target target,
1280  GLint level,
1281  PixelDataInternalFormat internal_format,
1282  GLsizei width,
1283  GLint border,
1284  PixelDataFormat format,
1285  Property::PixDataType type,
1286  const void* data
1287  )
1288  {
1289  OGLPLUS_GLFUNC(TexImage1D)(
1290  GLenum(target),
1291  level,
1292  GLint(internal_format),
1293  width,
1294  border,
1295  GLenum(format),
1296  GLenum(type),
1297  data
1298  );
1299  OGLPLUS_CHECK(
1300  TexImage1D,
1301  ObjectError,
1302  ObjectBinding(target).
1303  EnumParam(internal_format).
1304  Index(level)
1305  );
1306  }
1307 
1309 
1313  static void Image1D(
1314  Target target,
1315  const images::Image& image,
1316  GLint level = 0,
1317  GLint border = 0
1318  );
1319 
1321 
1325  static void SubImage1D(
1326  Target target,
1327  GLint level,
1328  GLint xoffs,
1329  GLsizei width,
1330  PixelDataFormat format,
1331  Property::PixDataType type,
1332  const void* data
1333  )
1334  {
1335  OGLPLUS_GLFUNC(TexSubImage1D)(
1336  GLenum(target),
1337  level,
1338  xoffs,
1339  width,
1340  GLenum(format),
1341  GLenum(type),
1342  data
1343  );
1344  OGLPLUS_CHECK(
1345  TexSubImage1D,
1346  ObjectError,
1347  ObjectBinding(target).
1348  EnumParam(format).
1349  Index(level)
1350  );
1351  }
1352 
1354 
1358  static void SubImage1D(
1359  Target target,
1360  const images::Image& image,
1361  GLint xoffs,
1362  GLint level = 0
1363  );
1364 #endif // GL_VERSION_3_0
1365 
1367 
1373  static void Image(
1374  Target target,
1375  const images::Image& image,
1376  GLint level = 0,
1377  GLint border = 0
1378  );
1379 
1381 
1387  static void Image(
1388  Target target,
1389  const images::ImageSpec& image_spec,
1390  GLint level = 0,
1391  GLint border = 0
1392  );
1393 
1395 
1399  static void CopyImage2D(
1400  Target target,
1401  GLint level,
1402  PixelDataInternalFormat internal_format,
1403  GLint x,
1404  GLint y,
1405  GLsizei width,
1406  GLsizei height,
1407  GLint border
1408  )
1409  {
1410  OGLPLUS_GLFUNC(CopyTexImage2D)(
1411  GLenum(target),
1412  level,
1413  GLint(internal_format),
1414  x,
1415  y,
1416  width,
1417  height,
1418  border
1419  );
1420  OGLPLUS_CHECK(
1421  CopyTexImage2D,
1422  ObjectError,
1423  ObjectBinding(target).
1424  EnumParam(internal_format).
1425  Index(level)
1426  );
1427  }
1428 
1429 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_3_0
1430 
1435  static void CopyImage1D(
1436  Target target,
1437  GLint level,
1438  PixelDataInternalFormat internal_format,
1439  GLint x,
1440  GLint y,
1441  GLsizei width,
1442  GLint border
1443  )
1444  {
1445  OGLPLUS_GLFUNC(CopyTexImage1D)(
1446  GLenum(target),
1447  level,
1448  GLint(internal_format),
1449  x,
1450  y,
1451  width,
1452  border
1453  );
1454  OGLPLUS_CHECK(
1455  CopyTexImage1D,
1456  ObjectError,
1457  ObjectBinding(target).
1458  EnumParam(internal_format).
1459  Index(level)
1460  );
1461  }
1462 #endif // GL_VERSION_3_0
1463 
1465 
1469  static void CopySubImage3D(
1470  Target target,
1471  GLint level,
1472  GLint xoffs,
1473  GLint yoffs,
1474  GLint zoffs,
1475  GLint x,
1476  GLint y,
1477  GLsizei width,
1478  GLsizei height
1479  )
1480  {
1481  OGLPLUS_GLFUNC(CopyTexSubImage3D)(
1482  GLenum(target),
1483  level,
1484  xoffs,
1485  yoffs,
1486  zoffs,
1487  x,
1488  y,
1489  width,
1490  height
1491  );
1492  OGLPLUS_CHECK(
1493  CopyTexSubImage3D,
1494  ObjectError,
1495  ObjectBinding(target).
1496  Index(level)
1497  );
1498  }
1499 
1501 
1505  static void CopySubImage2D(
1506  Target target,
1507  GLint level,
1508  GLint xoffs,
1509  GLint yoffs,
1510  GLint x,
1511  GLint y,
1512  GLsizei width,
1513  GLsizei height
1514  )
1515  {
1516  OGLPLUS_GLFUNC(CopyTexSubImage2D)(
1517  GLenum(target),
1518  level,
1519  xoffs,
1520  yoffs,
1521  x,
1522  y,
1523  width,
1524  height
1525  );
1526  OGLPLUS_CHECK(
1527  CopyTexSubImage2D,
1528  ObjectError,
1529  ObjectBinding(target).
1530  Index(level)
1531  );
1532  }
1533 
1534 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_3_0
1535 
1540  static void CopySubImage1D(
1541  Target target,
1542  GLint level,
1543  GLint xoffs,
1544  GLint x,
1545  GLint y,
1546  GLsizei width
1547  )
1548  {
1549  OGLPLUS_GLFUNC(CopyTexSubImage1D)(
1550  GLenum(target),
1551  level,
1552  xoffs,
1553  x,
1554  y,
1555  width
1556  );
1557  OGLPLUS_CHECK(
1558  CopyTexSubImage1D,
1559  ObjectError,
1560  ObjectBinding(target).
1561  Index(level)
1562  );
1563  }
1564 #endif // GL_VERSION_3_0
1565 
1567 
1571  static void CompressedImage3D(
1572  Target target,
1573  GLint level,
1574  PixelDataInternalFormat internal_format,
1575  GLsizei width,
1576  GLsizei height,
1577  GLsizei depth,
1578  GLint border,
1579  GLsizei image_size,
1580  const void* data
1581  )
1582  {
1583  OGLPLUS_GLFUNC(CompressedTexImage3D)(
1584  GLenum(target),
1585  level,
1586  GLint(internal_format),
1587  width,
1588  height,
1589  depth,
1590  border,
1591  image_size,
1592  data
1593  );
1594  OGLPLUS_CHECK(
1595  CompressedTexImage3D,
1596  ObjectError,
1597  ObjectBinding(target).
1598  EnumParam(internal_format).
1599  Index(level)
1600  );
1601  }
1602 
1604 
1608  static void CompressedImage2D(
1609  Target target,
1610  GLint level,
1611  PixelDataInternalFormat internal_format,
1612  GLsizei width,
1613  GLsizei height,
1614  GLint border,
1615  GLsizei image_size,
1616  const void* data
1617  )
1618  {
1619  OGLPLUS_GLFUNC(CompressedTexImage2D)(
1620  GLenum(target),
1621  level,
1622  GLint(internal_format),
1623  width,
1624  height,
1625  border,
1626  image_size,
1627  data
1628  );
1629  OGLPLUS_CHECK(
1630  CompressedTexImage2D,
1631  ObjectError,
1632  ObjectBinding(target).
1633  EnumParam(internal_format).
1634  Index(level)
1635  );
1636  }
1637 
1638 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_3_0
1639 
1644  static void CompressedImage1D(
1645  Target target,
1646  GLint level,
1647  PixelDataInternalFormat internal_format,
1648  GLsizei width,
1649  GLint border,
1650  GLsizei image_size,
1651  const void* data
1652  )
1653  {
1654  OGLPLUS_GLFUNC(CompressedTexImage1D)(
1655  GLenum(target),
1656  level,
1657  GLint(internal_format),
1658  width,
1659  border,
1660  image_size,
1661  data
1662  );
1663  OGLPLUS_CHECK(
1664  CompressedTexImage1D,
1665  ObjectError,
1666  ObjectBinding(target).
1667  EnumParam(internal_format).
1668  Index(level)
1669  );
1670  }
1671 #endif // GL_VERSION_3_0
1672 
1674 
1679  Target target,
1680  GLint level,
1681  GLint xoffs,
1682  GLint yoffs,
1683  GLint zoffs,
1684  GLsizei width,
1685  GLsizei height,
1686  GLsizei depth,
1687  PixelDataFormat format,
1688  GLsizei image_size,
1689  const void* data
1690  )
1691  {
1692  OGLPLUS_GLFUNC(CompressedTexSubImage3D)(
1693  GLenum(target),
1694  level,
1695  xoffs,
1696  yoffs,
1697  zoffs,
1698  width,
1699  height,
1700  depth,
1701  GLint(format),
1702  image_size,
1703  data
1704  );
1705  OGLPLUS_CHECK(
1706  CompressedTexSubImage3D,
1707  ObjectError,
1708  ObjectBinding(target).
1709  EnumParam(format).
1710  Index(level)
1711  );
1712  }
1713 
1715 
1720  Target target,
1721  GLint level,
1722  GLint xoffs,
1723  GLint yoffs,
1724  GLsizei width,
1725  GLsizei height,
1726  PixelDataFormat format,
1727  GLsizei image_size,
1728  const void* data
1729  )
1730  {
1731  OGLPLUS_GLFUNC(CompressedTexSubImage2D)(
1732  GLenum(target),
1733  level,
1734  xoffs,
1735  yoffs,
1736  width,
1737  height,
1738  GLint(format),
1739  image_size,
1740  data
1741  );
1742  OGLPLUS_CHECK(
1743  CompressedTexSubImage2D,
1744  ObjectError,
1745  ObjectBinding(target).
1746  EnumParam(format).
1747  Index(level)
1748  );
1749  }
1750 
1751 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_3_0
1752 
1758  Target target,
1759  GLint level,
1760  GLint xoffs,
1761  GLsizei width,
1762  PixelDataFormat format,
1763  GLsizei image_size,
1764  const void* data
1765  )
1766  {
1767  OGLPLUS_GLFUNC(CompressedTexSubImage1D)(
1768  GLenum(target),
1769  level,
1770  xoffs,
1771  width,
1772  GLint(format),
1773  image_size,
1774  data
1775  );
1776  OGLPLUS_CHECK(
1777  CompressedTexSubImage1D,
1778  ObjectError,
1779  ObjectBinding(target).
1780  EnumParam(format).
1781  Index(level)
1782  );
1783  }
1784 #endif
1785 
1786 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_3_2 || GL_ARB_texture_multisample
1787 
1793  static void Image3DMultisample(
1794  Target target,
1795  GLsizei samples,
1796  PixelDataInternalFormat internal_format,
1797  GLsizei width,
1798  GLsizei height,
1799  GLsizei depth,
1800  bool fixed_sample_locations
1801  )
1802  {
1803  OGLPLUS_GLFUNC(TexImage3DMultisample)(
1804  GLenum(target),
1805  samples,
1806  GLint(internal_format),
1807  width,
1808  height,
1809  depth,
1810  fixed_sample_locations ? GL_TRUE : GL_FALSE
1811  );
1812  OGLPLUS_CHECK(
1813  TexImage3DMultisample,
1814  ObjectError,
1815  ObjectBinding(target).
1816  EnumParam(internal_format)
1817  );
1818  }
1819 
1821 
1826  static void Image2DMultisample(
1827  Target target,
1828  GLsizei samples,
1829  PixelDataInternalFormat internal_format,
1830  GLsizei width,
1831  GLsizei height,
1832  bool fixed_sample_locations
1833  )
1834  {
1835  OGLPLUS_GLFUNC(TexImage2DMultisample)(
1836  GLenum(target),
1837  samples,
1838  GLint(internal_format),
1839  width,
1840  height,
1841  fixed_sample_locations ? GL_TRUE : GL_FALSE
1842  );
1843  OGLPLUS_CHECK(
1844  TexImage2DMultisample,
1845  ObjectError,
1846  ObjectBinding(target).
1847  EnumParam(internal_format)
1848  );
1849  }
1850 #endif // texture multisample
1851 
1852 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_3_1
1853 
1859  static void Buffer(
1860  Target target,
1861  PixelDataInternalFormat internal_format,
1862  BufferName buffer
1863  )
1864  {
1865  OGLPLUS_GLFUNC(TexBuffer)(
1866  GLenum(target),
1867  GLenum(internal_format),
1868  GetGLName(buffer)
1869  );
1870  OGLPLUS_CHECK(
1871  TexBuffer,
1872  ObjectPairError,
1873  Subject(buffer).
1874  ObjectBinding(target).
1875  EnumParam(internal_format)
1876  );
1877  }
1878 #endif
1879 
1880 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_4_3
1881 
1887  static void BufferRange(
1888  Target target,
1889  PixelDataInternalFormat internal_format,
1890  BufferName buffer,
1891  GLintptr offset,
1892  GLsizeiptr size
1893  )
1894  {
1895  OGLPLUS_GLFUNC(TexBufferRange)(
1896  GLenum(target),
1897  GLenum(internal_format),
1898  GetGLName(buffer),
1899  offset,
1900  size
1901  );
1902  OGLPLUS_CHECK(
1903  TexBufferRange,
1904  ObjectPairError,
1905  Subject(buffer).
1906  ObjectBinding(target).
1907  EnumParam(internal_format)
1908  );
1909  }
1910 #endif
1911 
1912 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_4_2 || GL_ARB_texture_storage
1913 
1919  static void Storage1D(
1920  Target target,
1921  GLsizei levels,
1922  PixelDataInternalFormat internal_format,
1923  GLsizei width
1924  )
1925  {
1926  OGLPLUS_GLFUNC(TexStorage1D)(
1927  GLenum(target),
1928  levels,
1929  GLenum(internal_format),
1930  width
1931  );
1932  OGLPLUS_CHECK(
1933  TexStorage1D,
1934  ObjectError,
1935  ObjectBinding(target).
1936  EnumParam(internal_format)
1937  );
1938  }
1939 
1941 
1946  static void Storage2D(
1947  Target target,
1948  GLsizei levels,
1949  PixelDataInternalFormat internal_format,
1950  GLsizei width,
1951  GLsizei height
1952  )
1953  {
1954  OGLPLUS_GLFUNC(TexStorage2D)(
1955  GLenum(target),
1956  levels,
1957  GLenum(internal_format),
1958  width,
1959  height
1960  );
1961  OGLPLUS_CHECK(
1962  TexStorage2D,
1963  ObjectError,
1964  ObjectBinding(target).
1965  EnumParam(internal_format)
1966  );
1967  }
1968 
1970 
1975  static void Storage3D(
1976  Target target,
1977  GLsizei levels,
1978  PixelDataInternalFormat internal_format,
1979  GLsizei width,
1980  GLsizei height,
1981  GLsizei depth
1982  )
1983  {
1984  OGLPLUS_GLFUNC(TexStorage3D)(
1985  GLenum(target),
1986  levels,
1987  GLenum(internal_format),
1988  width,
1989  height,
1990  depth
1991  );
1992  OGLPLUS_CHECK(
1993  TexStorage3D,
1994  ObjectError,
1995  ObjectBinding(target).
1996  EnumParam(internal_format)
1997  );
1998  }
1999 #endif
2000 
2002 
2007  static GLuint BaseLevel(Target target)
2008  {
2009  return GetIntParam(target, GL_TEXTURE_BASE_LEVEL);
2010  }
2011 
2013 
2018  static void BaseLevel(Target target, GLuint level)
2019  {
2020  OGLPLUS_GLFUNC(TexParameteri)(
2021  GLenum(target),
2022  GL_TEXTURE_BASE_LEVEL,
2023  level
2024  );
2025  OGLPLUS_CHECK(
2026  TexParameteri,
2027  ObjectError,
2028  ObjectBinding(target).
2029  Index(level)
2030  );
2031  }
2032 
2033 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_3_0
2034 
2041  {
2042  GLfloat result[4];
2043  OGLPLUS_GLFUNC(GetTexParameterfv)(
2044  GLenum(target),
2045  GL_TEXTURE_BORDER_COLOR,
2046  result
2047  );
2048  OGLPLUS_CHECK(
2049  GetTexParameterfv,
2050  ObjectError,
2051  ObjectBinding(target)
2052  );
2053  return Vector<GLfloat, 4>(result, 4);
2054  }
2055 
2057 
2062  static void BorderColor(Target target, Vector<GLfloat, 4> color)
2063  {
2064  OGLPLUS_GLFUNC(TexParameterfv)(
2065  GLenum(target),
2066  GL_TEXTURE_BORDER_COLOR,
2067  Data(color)
2068  );
2069  OGLPLUS_CHECK(
2070  TexParameterfv,
2071  ObjectError,
2072  ObjectBinding(target)
2073  );
2074  }
2075 
2077 
2083  {
2084  GLint result[4];
2085  OGLPLUS_GLFUNC(GetTexParameterIiv)(
2086  GLenum(target),
2087  GL_TEXTURE_BORDER_COLOR,
2088  result
2089  );
2090  OGLPLUS_CHECK(
2091  GetTexParameterIiv,
2092  ObjectError,
2093  ObjectBinding(target)
2094  );
2095  return Vector<GLint, 4>(result, 4);
2096  }
2097 
2099 
2104  static void BorderColor(Target target, Vector<GLint, 4> color)
2105  {
2106  OGLPLUS_GLFUNC(TexParameterIiv)(
2107  GLenum(target),
2108  GL_TEXTURE_BORDER_COLOR,
2109  Data(color)
2110  );
2111  OGLPLUS_CHECK(
2112  TexParameterIiv,
2113  ObjectError,
2114  ObjectBinding(target)
2115  );
2116  }
2117 
2119 
2125  {
2126  GLuint result[4];
2127  OGLPLUS_GLFUNC(GetTexParameterIuiv)(
2128  GLenum(target),
2129  GL_TEXTURE_BORDER_COLOR,
2130  result
2131  );
2132  OGLPLUS_CHECK(
2133  GetTexParameterIuiv,
2134  ObjectError,
2135  ObjectBinding(target)
2136  );
2137  return Vector<GLuint, 4>(result, 4);
2138  }
2139 
2141 
2146  static void BorderColor(Target target, Vector<GLuint, 4> color)
2147  {
2148  OGLPLUS_GLFUNC(TexParameterIuiv)(
2149  GLenum(target),
2150  GL_TEXTURE_BORDER_COLOR,
2151  Data(color)
2152  );
2153  OGLPLUS_CHECK(
2154  TexParameterIuiv,
2155  ObjectError,
2156  ObjectBinding(target)
2157  );
2158  }
2159 #endif // GL_VERSION_3_0
2160 
2162 
2168  {
2169  return TextureCompareMode(GetIntParam(
2170  target,
2171  GL_TEXTURE_COMPARE_MODE
2172  ));
2173  }
2174 
2176 
2181  static void CompareMode(Target target, TextureCompareMode mode)
2182  {
2183  OGLPLUS_GLFUNC(TexParameteri)(
2184  GLenum(target),
2185  GL_TEXTURE_COMPARE_MODE,
2186  GLenum(mode)
2187  );
2188  OGLPLUS_CHECK(
2189  TexParameteri,
2190  ObjectError,
2191  ObjectBinding(target).
2192  EnumParam(mode)
2193  );
2194  }
2195 
2197 
2203  {
2204  return CompareFunction(GetIntParam(
2205  target,
2206  GL_TEXTURE_COMPARE_FUNC
2207  ));
2208  }
2209 
2211 
2216  static void CompareFunc(Target target, CompareFunction func)
2217  {
2218  OGLPLUS_GLFUNC(TexParameteri)(
2219  GLenum(target),
2220  GL_TEXTURE_COMPARE_FUNC,
2221  GLenum(func)
2222  );
2223  OGLPLUS_CHECK(
2224  TexParameteri,
2225  ObjectError,
2226  ObjectBinding(target).
2227  EnumParam(func)
2228  );
2229  }
2230 
2231 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_3_0
2232 
2238  static GLfloat LODBias(Target target)
2239  {
2240  return GetFloatParam(target, GL_TEXTURE_LOD_BIAS);
2241  }
2242 
2244 
2249  static void LODBias(Target target, GLfloat value)
2250  {
2251  OGLPLUS_GLFUNC(TexParameterf)(
2252  GLenum(target),
2253  GL_TEXTURE_LOD_BIAS,
2254  value
2255  );
2256  OGLPLUS_CHECK(
2257  TexParameterf,
2258  ObjectError,
2259  ObjectBinding(target)
2260  );
2261  }
2262 #endif // GL_VERSION_3_0
2263 
2265 
2271  static void Filter(Target target, TextureFilter filter)
2272  {
2273  OGLPLUS_GLFUNC(TexParameteri)(
2274  GLenum(target),
2275  GL_TEXTURE_MIN_FILTER,
2276  GLenum(filter)
2277  );
2278  OGLPLUS_CHECK(
2279  TexParameteri,
2280  ObjectError,
2281  ObjectBinding(target).
2282  EnumParam(filter)
2283  );
2284  OGLPLUS_GLFUNC(TexParameteri)(
2285  GLenum(target),
2286  GL_TEXTURE_MAG_FILTER,
2287  GLenum(filter)
2288  );
2289  OGLPLUS_CHECK(
2290  TexParameteri,
2291  ObjectError,
2292  ObjectBinding(target).
2293  EnumParam(filter)
2294  );
2295  }
2296 
2298 
2304  {
2305  return TextureMagFilter(GetIntParam(
2306  target,
2307  GL_TEXTURE_MAG_FILTER
2308  ));
2309  }
2310 
2312 
2317  static void MagFilter(Target target, TextureMagFilter filter)
2318  {
2319  OGLPLUS_GLFUNC(TexParameteri)(
2320  GLenum(target),
2321  GL_TEXTURE_MAG_FILTER,
2322  GLenum(filter)
2323  );
2324  OGLPLUS_CHECK(
2325  TexParameteri,
2326  ObjectError,
2327  ObjectBinding(target).
2328  EnumParam(filter)
2329  );
2330  }
2331 
2333 
2339  {
2340  return TextureMinFilter(GetIntParam(
2341  target,
2342  GL_TEXTURE_MIN_FILTER
2343  ));
2344  }
2345 
2347 
2352  static void MinFilter(Target target, TextureMinFilter filter)
2353  {
2354  OGLPLUS_GLFUNC(TexParameteri)(
2355  GLenum(target),
2356  GL_TEXTURE_MIN_FILTER,
2357  GLenum(filter)
2358  );
2359  OGLPLUS_CHECK(
2360  TexParameteri,
2361  ObjectError,
2362  ObjectBinding(target).
2363  EnumParam(filter)
2364  );
2365  }
2366 
2368 
2373  static GLfloat MinLOD(Target target)
2374  {
2375  return GetFloatParam(target, GL_TEXTURE_MIN_LOD);
2376  }
2377 
2379 
2384  static void MinLOD(Target target, GLfloat value)
2385  {
2386  OGLPLUS_GLFUNC(TexParameterf)(
2387  GLenum(target),
2388  GL_TEXTURE_MIN_LOD,
2389  value
2390  );
2391  OGLPLUS_CHECK(
2392  TexParameterf,
2393  ObjectError,
2394  ObjectBinding(target)
2395  );
2396  }
2397 
2399 
2404  static GLfloat MaxLOD(Target target)
2405  {
2406  return GetFloatParam(target, GL_TEXTURE_MAX_LOD);
2407  }
2408 
2410 
2415  static void MaxLOD(Target target, GLfloat value)
2416  {
2417  OGLPLUS_GLFUNC(TexParameterf)(
2418  GLenum(target),
2419  GL_TEXTURE_MAX_LOD,
2420  value
2421  );
2422  OGLPLUS_CHECK(
2423  TexParameterf,
2424  ObjectError,
2425  ObjectBinding(target)
2426  );
2427  }
2428 
2430 
2435  static GLint MaxLevel(Target target)
2436  {
2437  return GetIntParam(target, GL_TEXTURE_MAX_LEVEL);
2438  }
2439 
2441 
2446  static void MaxLevel(Target target, GLint value)
2447  {
2448  OGLPLUS_GLFUNC(TexParameteri)(
2449  GLenum(target),
2450  GL_TEXTURE_MAX_LEVEL,
2451  value
2452  );
2453  OGLPLUS_CHECK(
2454  TexParameteri,
2455  ObjectError,
2456  ObjectBinding(target)
2457  );
2458  }
2459 
2461 
2466  static GLfloat MaxAnisotropy(Target target)
2467  {
2468 #ifdef GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT
2469  return GetFloatParam(
2470  target,
2471  GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT
2472  );
2473 #else
2474  OGLPLUS_FAKE_USE(target);
2475  return GLfloat(1);
2476 #endif
2477  }
2478 
2480 
2485  static GLfloat Anisotropy(Target target)
2486  {
2487 #ifdef GL_TEXTURE_MAX_ANISOTROPY_EXT
2488  return GetFloatParam(
2489  target,
2490  GL_TEXTURE_MAX_ANISOTROPY_EXT
2491  );
2492 #else
2493  OGLPLUS_FAKE_USE(target);
2494  return GLfloat(1);
2495 #endif
2496  }
2497 
2499 
2504  static void Anisotropy(Target target, GLfloat value)
2505  {
2506 #ifdef GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT
2507  OGLPLUS_GLFUNC(TexParameterf)(
2508  GLenum(target),
2509  GL_TEXTURE_MAX_ANISOTROPY_EXT,
2510  value
2511  );
2512  OGLPLUS_CHECK(
2513  TexParameterf,
2514  ObjectError,
2515  ObjectBinding(target)
2516  );
2517 #else
2518  OGLPLUS_FAKE_USE(target);
2519  OGLPLUS_FAKE_USE(value);
2520 #endif
2521  }
2522 
2523 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_3_3 || GL_ARB_texture_swizzle
2524 
2531  {
2532  return TextureSwizzle(GetIntParam(
2533  target,
2534  GLenum(coord)
2535  ));
2536  }
2537 
2539 
2544  static void Swizzle(
2545  Target target,
2546  TextureSwizzleCoord coord,
2547  TextureSwizzle mode
2548  )
2549  {
2550  OGLPLUS_GLFUNC(TexParameteri)(
2551  GLenum(target),
2552  GLenum(coord),
2553  GLenum(mode)
2554  );
2555  OGLPLUS_CHECK(
2556  TexParameteri,
2557  ObjectError,
2558  ObjectBinding(target).
2559  EnumParam(mode)
2560  );
2561  }
2562 
2564 
2571  {
2572  return Swizzle(target, TextureSwizzleCoord::R);
2573  }
2574 
2576 
2582  static void SwizzleR(Target target, TextureSwizzle mode)
2583  {
2584  Swizzle(target, TextureSwizzleCoord::R, mode);
2585  }
2586 
2588 
2595  {
2596  return Swizzle(target, TextureSwizzleCoord::G);
2597  }
2598 
2600 
2606  static void SwizzleG(Target target, TextureSwizzle mode)
2607  {
2608  Swizzle(target, TextureSwizzleCoord::G, mode);
2609  }
2610 
2612 
2619  {
2620  return Swizzle(target, TextureSwizzleCoord::B);
2621  }
2622 
2624 
2630  static void SwizzleB(Target target, TextureSwizzle mode)
2631  {
2632  Swizzle(target, TextureSwizzleCoord::B, mode);
2633  }
2634 
2636 
2643  {
2644  return Swizzle(target, TextureSwizzleCoord::A);
2645  }
2646 
2648 
2654  static void SwizzleA(Target target, TextureSwizzle mode)
2655  {
2656  Swizzle(target, TextureSwizzleCoord::A, mode);
2657  }
2658 
2660 
2667  {
2668  TextureSwizzleTuple result;
2669  OGLPLUS_GLFUNC(GetTexParameteriv)(
2670  GLenum(target),
2671  GL_TEXTURE_SWIZZLE_RGBA,
2672  result.Values()
2673  );
2674  OGLPLUS_CHECK(
2675  GetTexParameteriv,
2676  ObjectError,
2677  ObjectBinding(target)
2678  );
2679  return result;
2680  }
2681 
2683 
2689  static void SwizzleRGBA(Target target, TextureSwizzle mode)
2690  {
2691  GLint m = GLint(GLenum(mode));
2692  GLint params[4] = {m, m, m, m};
2693 
2694  OGLPLUS_GLFUNC(TexParameteriv)(
2695  GLenum(target),
2696  GL_TEXTURE_SWIZZLE_RGBA,
2697  params
2698  );
2699  OGLPLUS_CHECK(
2700  TexParameteriv,
2701  ObjectError,
2702  ObjectBinding(target).
2703  EnumParam(mode)
2704  );
2705  }
2706 
2708 
2714  static void SwizzleRGBA(
2715  Target target,
2716  TextureSwizzle mode_r,
2717  TextureSwizzle mode_g,
2718  TextureSwizzle mode_b,
2719  TextureSwizzle mode_a
2720  )
2721  {
2722  GLint params[4] = {
2723  GLint(GLenum(mode_r)),
2724  GLint(GLenum(mode_g)),
2725  GLint(GLenum(mode_b)),
2726  GLint(GLenum(mode_a))
2727  };
2728 
2729  OGLPLUS_GLFUNC(TexParameteriv)(
2730  GLenum(target),
2731  GL_TEXTURE_SWIZZLE_RGBA,
2732  params
2733  );
2734  OGLPLUS_CHECK(
2735  TexParameteriv,
2736  ObjectError,
2737  ObjectBinding(target)
2738  );
2739  }
2740 
2742 
2748  static void SwizzleRGBA(Target target, const TextureSwizzleTuple& modes)
2749  {
2750  OGLPLUS_GLFUNC(TexParameteriv)(
2751  GLenum(target),
2752  GL_TEXTURE_SWIZZLE_RGBA,
2753  modes.Values()
2754  );
2755  OGLPLUS_CHECK(
2756  TexParameteriv,
2757  ObjectError,
2758  ObjectBinding(target)
2759  );
2760  }
2761 #endif // texture swizzle
2762 
2764 
2768  static TextureWrap Wrap(Target target, TextureWrapCoord coord)
2769  {
2770  return TextureWrap(GetIntParam(
2771  target,
2772  GLenum(coord)
2773  ));
2774  }
2775 
2777 
2781  static void Wrap(
2782  Target target,
2783  TextureWrapCoord coord,
2784  TextureWrap mode
2785  )
2786  {
2787  OGLPLUS_GLFUNC(TexParameteri)(
2788  GLenum(target),
2789  GLenum(coord),
2790  GLenum(mode)
2791  );
2792  OGLPLUS_CHECK(
2793  TexParameteri,
2794  ObjectError,
2795  ObjectBinding(target).
2796  EnumParam(mode)
2797  );
2798  }
2799 
2801 
2806  static TextureWrap WrapS(Target target)
2807  {
2808  return Wrap(target, TextureWrapCoord::S);
2809  }
2810 
2812 
2817  static void WrapS(Target target, TextureWrap mode)
2818  {
2819  Wrap(target, TextureWrapCoord::S, mode);
2820  }
2821 
2823 
2828  static TextureWrap WrapT(Target target)
2829  {
2830  return Wrap(target, TextureWrapCoord::T);
2831  }
2832 
2834 
2839  static void WrapT(Target target, TextureWrap mode)
2840  {
2841  Wrap(target, TextureWrapCoord::T, mode);
2842  }
2843 
2845 
2850  static TextureWrap WrapR(Target target)
2851  {
2852  return Wrap(target, TextureWrapCoord::R);
2853  }
2854 
2856 
2861  static void WrapR(Target target, TextureWrap mode)
2862  {
2863  Wrap(target, TextureWrapCoord::R, mode);
2864  }
2865 
2866 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_4_3
2867 
2875  {
2876  return PixelDataFormat(GetIntParam(
2877  target,
2878  GL_DEPTH_STENCIL_TEXTURE_MODE
2879  ));
2880  }
2881 
2883 
2889  static void DepthStencilMode(
2890  Target target,
2891  PixelDataFormat mode
2892  )
2893  {
2894  OGLPLUS_GLFUNC(TexParameteri)(
2895  GLenum(target),
2896  GL_DEPTH_STENCIL_TEXTURE_MODE,
2897  GLenum(mode)
2898  );
2899  OGLPLUS_CHECK(
2900  TexParameteri,
2901  ObjectError,
2902  ObjectBinding(target).
2903  EnumParam(mode)
2904  );
2905  }
2906 #endif
2907 
2908 #if OGLPLUS_DOCUMENTATION_ONLY || GL_ARB_seamless_cubemap_per_texture
2909 
2916  static bool Seamless(Target target)
2917  {
2918  return GetIntParam(
2919  target,
2920  GL_TEXTURE_CUBE_MAP_SEAMLESS
2921  ) == GL_TRUE;
2922  }
2923 
2925 
2931  static void Seamless(Target target, bool enable)
2932  {
2933  OGLPLUS_GLFUNC(TexParameteri)(
2934  GLenum(target),
2935  GL_TEXTURE_CUBE_MAP_SEAMLESS,
2936  enable?GL_TRUE:GL_FALSE
2937  );
2938  OGLPLUS_CHECK(
2939  TexParameteri,
2940  ObjectError,
2941  ObjectBinding(target)
2942  );
2943  }
2944 #endif
2945 
2946 #if OGLPLUS_DOCUMENTATION_ONLY || \
2947  GL_VERSION_4_5 || \
2948  GL_ARB_texture_barrier || \
2949  GL_NV_texture_barrier
2950 
2956  static void Barrier(void)
2957  {
2958 #if GL_VERSION_4_5 || GL_ARB_texture_barrier
2959  OGLPLUS_GLFUNC(TextureBarrier)();
2960  OGLPLUS_VERIFY_SIMPLE(TextureBarrier);
2961 #elif GL_NV_texture_barrier
2962  OGLPLUS_GLFUNC(TextureBarrierNV)();
2963  OGLPLUS_VERIFY_SIMPLE(TextureBarrierNV);
2964 #endif
2965  }
2966 #endif
2967 
2969 
2973  static void GenerateMipmap(Target target)
2974  {
2975  OGLPLUS_GLFUNC(GenerateMipmap)(GLenum(target));
2976  OGLPLUS_CHECK(
2977  GenerateMipmap,
2978  ObjectError,
2979  ObjectBinding(target)
2980  );
2981  }
2982 };
2983 
2985 typedef ObjZeroOps<tag::ExplicitSel, tag::Texture>
2987 
2988 template <>
2989 class ObjectOps<tag::ExplicitSel, tag::Texture>
2990  : public ObjZeroOps<tag::ExplicitSel, tag::Texture>
2991 {
2992 protected:
2993  ObjectOps(void){ }
2994 };
2995 
2997 typedef ObjectOps<tag::ExplicitSel, tag::Texture>
2999 
3000 
3002 struct TextureMipmap { };
3003 
3004 // Helper class for syntax-sugar operators
3005 struct TextureTargetAndSlot
3006 {
3007  TextureTarget target;
3008  GLint slot;
3009 
3010  TextureTargetAndSlot(TextureTarget& t, GLint s)
3011  : target(t)
3012  , slot(s)
3013  { }
3014 };
3015 
3016 // syntax sugar operators
3017 inline TextureTargetAndSlot operator | (TextureTarget target, GLuint slot)
3018 {
3019  return TextureTargetAndSlot(target, slot);
3020 }
3021 
3022 // helper class for syntax-sugar operators
3023 struct TextureUnitAndTarget
3024 {
3025  TextureUnitSelector unit;
3026  TextureTarget tgt;
3027 
3028  TextureUnitAndTarget(TextureUnitSelector u, TextureTarget t)
3029  : unit(u)
3030  , tgt(t)
3031  { }
3032 };
3033 
3034 // syntax sugar operators
3035 inline TextureUnitAndTarget operator | (
3036  TextureUnitSelector unit,
3037  TextureTarget tex
3038 )
3039 {
3040  return TextureUnitAndTarget(unit, tex);
3041 }
3042 
3043 // Bind
3044 inline TextureTarget operator << (
3045  const DefaultTextureOps& tex,
3046  TextureTarget target
3047 )
3048 {
3049  tex.Bind(target);
3050  return target;
3051 }
3052 
3053 // Filter
3054 inline TextureTarget operator << (TextureTarget target, TextureFilter filter)
3055 {
3056  DefaultTextureOps::Filter(target, filter);
3057  return target;
3058 }
3059 
3060 // MinFilter
3061 inline TextureTarget operator << (TextureTarget target, TextureMinFilter filter)
3062 {
3063  DefaultTextureOps::MinFilter(target, filter);
3064  return target;
3065 }
3066 
3067 // MagFilter
3068 inline TextureTarget operator << (TextureTarget target, TextureMagFilter filter)
3069 {
3070  DefaultTextureOps::MagFilter(target, filter);
3071  return target;
3072 }
3073 
3074 // CompareMode
3075 inline TextureTarget operator << (TextureTarget target, TextureCompareMode mode)
3076 {
3077  DefaultTextureOps::CompareMode(target, mode);
3078  return target;
3079 }
3080 
3081 // CompareFunc
3082 inline TextureTarget operator << (TextureTarget target, CompareFunction func)
3083 {
3084  DefaultTextureOps::CompareFunc(target, func);
3085  return target;
3086 }
3087 
3088 // Wrap
3089 inline TextureTarget operator << (TextureTarget target, TextureWrap wrap)
3090 {
3091  switch(TextureTargetDimensions(target))
3092  {
3093  case 3: DefaultTextureOps::WrapR(target, wrap);
3094  case 2: DefaultTextureOps::WrapT(target, wrap);
3095  case 1: DefaultTextureOps::WrapS(target, wrap);
3096  case 0: break;
3097  default: assert(!"Invalid texture wrap dimension");
3098  }
3099  return target;
3100 }
3101 
3102 // Wrap
3103 inline TextureTargetAndSlot operator << (
3104  TextureTargetAndSlot tas,
3105  TextureWrap wrap
3106 )
3107 {
3108  switch(tas.slot)
3109  {
3110  case 0: DefaultTextureOps::WrapS(tas.target, wrap); break;
3111  case 1: DefaultTextureOps::WrapT(tas.target, wrap); break;
3112  case 2: DefaultTextureOps::WrapR(tas.target, wrap); break;
3113  default: assert(!"Invalid texture wrap slot");
3114  }
3115  return tas;
3116 }
3117 
3118 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_3_3 || GL_ARB_texture_swizzle
3119 // Swizzle
3120 inline TextureTarget operator << (TextureTarget target, TextureSwizzle swizzle)
3121 {
3122  DefaultTextureOps::SwizzleRGBA(target, swizzle);
3123  return target;
3124 }
3125 
3126 // Swizzle
3127 inline TextureTargetAndSlot operator << (
3128  TextureTargetAndSlot tas,
3129  TextureSwizzle swizzle
3130 )
3131 {
3132  switch(tas.slot)
3133  {
3134  case 0: DefaultTextureOps::SwizzleR(tas.target, swizzle); break;
3135  case 1: DefaultTextureOps::SwizzleG(tas.target, swizzle); break;
3136  case 2: DefaultTextureOps::SwizzleB(tas.target, swizzle); break;
3137  case 3: DefaultTextureOps::SwizzleA(tas.target, swizzle); break;
3138  default: assert(!"Invalid texture swizzle slot");
3139  }
3140  return tas;
3141 }
3142 #endif
3143 
3144 #if OGLPLUS_DOCUMENTATION_ONLY || GL_VERSION_3_0
3145 // BorderColor
3146 template <typename T>
3147 inline TextureTarget operator << (
3148  TextureTarget target,
3149  const Vector<T, 4>& col
3150 )
3151 {
3152  DefaultTextureOps::BorderColor(target, col);
3153  return target;
3154 }
3155 #endif
3156 
3157 // Image
3158 inline TextureTarget operator << (
3159  TextureTarget target,
3160  const images::Image& image
3161 )
3162 {
3163  DefaultTextureOps::Image(target, image);
3164  return target;
3165 }
3166 
3167 // Image
3168 inline TextureTarget operator << (
3169  TextureTarget target,
3170  const images::ImageSpec& image_spec
3171 )
3172 {
3173  DefaultTextureOps::Image(target, image_spec);
3174  return target;
3175 }
3176 
3177 // Image + Level
3178 inline TextureTarget operator << (
3179  TextureTargetAndSlot tas,
3180  const images::Image& image
3181 )
3182 {
3183  DefaultTextureOps::Image(tas.target, image, tas.slot);
3184  return tas.target;
3185 }
3186 
3187 // Image + Level
3188 inline TextureTarget operator << (
3189  TextureTargetAndSlot tas,
3190  const images::ImageSpec& image_spec
3191 )
3192 {
3193  DefaultTextureOps::Image(tas.target, image_spec, tas.slot);
3194  return tas.target;
3195 }
3196 
3197 // GenerateMipmap
3198 inline TextureTarget operator << (
3199  TextureTarget target,
3200  TextureMipmap
3201 )
3202 {
3204  return target;
3205 }
3206 
3208 
3211 typedef ObjectZero<DefaultTextureOps> DefaultTexture;
3212 
3214 
3217 typedef Object<TextureOps> Texture;
3218 
3219 } // namespace oglplus
3220 
3221 #if !OGLPLUS_LINK_LIBRARY || defined(OGLPLUS_IMPLEMENTING_LIBRARY)
3222 #include <oglplus/texture.ipp>
3223 #endif // OGLPLUS_LINK_LIBRARY
3224 
3225 #endif // include guard
static void Filter(Target target, TextureFilter filter)
Sets both the minification and magnification filter.
Definition: texture.hpp:2271
TextureMagFilter MagFilter
Magnification filter.
Definition: texture.hpp:536
Texture wrap enumerations.
static TextureWrap WrapS(Target target)
Gets the wrap parameter (TEXTURE_WRAP_S)
Definition: texture.hpp:2806
static void SwizzleB(Target target, TextureSwizzle mode)
Sets the swizzle parameter (TEXTURE_SWIZZLE_B)
Definition: texture.hpp:2630
static TextureCompareMode CompareMode(Target target)
Gets the compare mode (TEXTURE_COMPARE_MODE)
Definition: texture.hpp:2167
static void MagFilter(Target target, TextureMagFilter filter)
Sets the magnification filter (TEXTURE_MAG_FILTER)
Definition: texture.hpp:2317
ObjZeroOps< tag::ExplicitSel, tag::Texture > DefaultTextureOps
DefaultTexture operations with explicit selector.
Definition: texture.hpp:2986
Common base class for Object name sequences.
Definition: fwd.hpp:139
static void SubImage1D(Target target, GLint level, GLint xoffs, GLsizei width, PixelDataFormat format, Property::PixDataType type, const void *data)
Specifies a one dimensional texture sub image.
Definition: texture.hpp:1325
static void Wrap(Target target, TextureWrapCoord coord, TextureWrap mode)
Sets the wrap parameter (TEXTURE_WRAP_*)
Definition: texture.hpp:2781
static void Storage3D(Target target, GLsizei levels, PixelDataInternalFormat internal_format, GLsizei width, GLsizei height, GLsizei depth)
Specifies all levels of 3D texture at the same time.
Definition: texture.hpp:1975
static void CompressedSubImage1D(Target target, GLint level, GLint xoffs, GLsizei width, PixelDataFormat format, GLsizei image_size, const void *data)
Specifies a one dimensional compressed texture sub image.
Definition: texture.hpp:1757
static CompareFunction CompareFunc(Target target)
Sets the compare function (TEXTURE_COMPARE_FUNC)
Definition: texture.hpp:2202
static void BorderColor(Target target, Vector< GLfloat, 4 > color)
Sets the texture border color (TEXTURE_BORDER_COLOR)
Definition: texture.hpp:2062
TextureSwizzle
Texture swizzle enumeration.
Definition: texture_swizzle.hpp:53
static PixelDataFormat DepthStencilMode(Target target)
Gets the depth stencil mode parameter (DEPTH_STENCIL_TEXTURE_MODE)
Definition: texture.hpp:2874
static void CompressedImage2D(Target target, GLint level, PixelDataInternalFormat internal_format, GLsizei width, GLsizei height, GLint border, GLsizei image_size, const void *data)
Specifies a two dimensional compressed texture image.
Definition: texture.hpp:1608
TextureWrapCoord WrapCoord
Texture wrap mode for coordinate.
Definition: texture.hpp:553
static GLfloat MinLOD(Target target)
Gets minimal LOD value (TEXTURE_MIN_LOD)
Definition: texture.hpp:2373
static void GenerateMipmap(Target target)
Generate mipmap for the texture bound to the specified target.
Definition: texture.hpp:2973
void ClearSubImage(GLsizei level, GLint xoffs, GLint yoffs, GLint zoffs, GLsizei width, GLsizei height, GLsizei depth, PixelDataFormat format, const GLtype *data)
Clears the specified part of texture image.
Definition: texture.hpp:444
static void MinFilter(Target target, TextureMinFilter filter)
Sets the minification filter (TEXTURE_MIN_FILTER)
Definition: texture.hpp:2352
static TextureName Binding(Target target)
Returns the current Texture bound to specified target.
Definition: texture.hpp:120
TextureSwizzleCoord SwizzleCoord
Texture swizzle coordinate.
Definition: texture.hpp:542
static GLfloat LODBias(Target target)
Gets the LOD bias value (TEXTURE_LOD_BIAS)
Definition: texture.hpp:2238
static void CopySubImage1D(Target target, GLint level, GLint xoffs, GLint x, GLint y, GLsizei width)
Copies a one dimensional texture sub image from the framebuffer.
Definition: texture.hpp:1540
Object< TextureOps > Texture
An oglplus_object encapsulating the texture object functionality.
Definition: texture.hpp:3217
static PixelDataInternalFormat InternalFormat(Target target, GLint level=0)
Returns the internal data format of the image array.
Definition: texture.hpp:886
static void Seamless(Target target, bool enable)
Sets the seamless cubemap setting.
Definition: texture.hpp:2931
static TextureSwizzle SwizzleB(Target target)
Gets the swizzle parameter (TEXTURE_SWIZZLE_B)
Definition: texture.hpp:2618
TextureFilter
Texture filter enumeration.
Definition: texture_filter.hpp:29
static void Bind(GLuint first, const Sequence< TextureName > &textures)
Sequentially bind textures to texture units starting with first.
Definition: texture.hpp:220
static void SubImage3D(Target target, GLint level, GLint xoffs, GLint yoffs, GLint zoffs, GLsizei width, GLsizei height, GLsizei depth, PixelDataFormat format, Property::PixDataType type, const void *data)
Specifies a three dimensional texture sub image.
Definition: texture.hpp:1056
DataType
OpenGL data type enumeration.
Definition: data_type.hpp:34
static void BindImage(GLuint first, const Sequence< TextureName > &textures)
Sequentially bind textures to image units starting with first.
Definition: texture.hpp:236
static void GetCompressedImage(Target target, GLint level, GLsizei size, GLubyte *buffer)
Allows to obtain the texture image in compressed form.
Definition: texture.hpp:973
static void Storage1D(Target target, GLsizei levels, PixelDataInternalFormat internal_format, GLsizei width)
Specifies all levels of 1D texture at the same time.
Definition: texture.hpp:1919
PixelDataInternalFormat
OpenGL pixel data internal format enumeration.
Definition: pixel_data.hpp:79
static void BaseLevel(Target target, GLuint level)
Sets the texture base level (TEXTURE_BASE_LEVEL)
Definition: texture.hpp:2018
static void CompressedImage3D(Target target, GLint level, PixelDataInternalFormat internal_format, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei image_size, const void *data)
Specifies a three dimensional compressed texture image.
Definition: texture.hpp:1571
static GLsizei CompressedImageSize(Target target, GLint level=0)
Returns the size (in bytes) of the image array if it is compressed.
Definition: texture.hpp:871
static void BindImage(ImageUnitSelector unit, TextureName texture, GLint level, bool layered, GLint layer, AccessSpecifier access, ImageUnitFormat format)
Binds a level of texture to an image unit.
Definition: texture.hpp:154
Access type specifier enumeration.
Class used for passing the address and size of a writable buffer to functions.
Definition: output_data.hpp:22
TextureSwizzle Swizzle
Texture swizzle value.
Definition: texture.hpp:545
static void Barrier(void)
Ensures that texture writes have been completed.
Definition: texture.hpp:2956
static void CompressedSubImage3D(Target target, GLint level, GLint xoffs, GLint yoffs, GLint zoffs, GLsizei width, GLsizei height, GLsizei depth, PixelDataFormat format, GLsizei image_size, const void *data)
Specifies a three dimensional compressed texture sub image.
Definition: texture.hpp:1678
static GLsizei AlphaSize(Target target, GLint level=0)
Returns the actual resolution of the ALPHA component.
Definition: texture.hpp:792
static void CompareMode(Target target, TextureCompareMode mode)
Sets the compare mode (TEXTURE_COMPARE_MODE)
Definition: texture.hpp:2181
static Vector< GLuint, 4 > BorderColor(Target target, TypeTag< GLuint >)
Gets the texture border color (TEXTURE_BORDER_COLOR)
Definition: texture.hpp:2124
static void SwizzleA(Target target, TextureSwizzle mode)
Sets the swizzle parameter (TEXTURE_SWIZZLE_A)
Definition: texture.hpp:2654
Forward declarations.
TextureMinFilter
Texture minification filter enumeration.
Definition: texture_filter.hpp:71
Declaration of OGLplus object-related error.
OneOf< GLenum, std::tuple< DataType, PixelDataType > > PixDataType
The pixel data type.
Definition: texture.hpp:565
static void WrapR(Target target, TextureWrap mode)
Sets the wrap parameter (TEXTURE_WRAP_R)
Definition: texture.hpp:2861
static void CompareFunc(Target target, CompareFunction func)
Sets the compare function (TEXTURE_COMPARE_FUNC)
Definition: texture.hpp:2216
Type for the image unit selector (implementation-dependent limited) number.
Definition: texture_unit.hpp:37
static void Bind(Target target, TextureName texture)
Binds the specified texture to the specified target.
Definition: texture.hpp:130
static TextureSwizzle SwizzleR(Target target)
Gets the swizzle parameter (TEXTURE_SWIZZLE_R)
Definition: texture.hpp:2570
Generic OpenGL object wrapper.
static GLfloat Anisotropy(Target target)
Gets the current anisotropy level.
Definition: texture.hpp:2485
static void SwizzleRGBA(Target target, const TextureSwizzleTuple &modes)
Sets the RGBA swizzle parameters (TEXTURE_SWIZZLE_RGBA)
Definition: texture.hpp:2748
A tag template used mainly for data-type-based function overload dispatching.
Definition: data_type.hpp:23
static void Image2DMultisample(Target target, GLsizei samples, PixelDataInternalFormat internal_format, GLsizei width, GLsizei height, bool fixed_sample_locations)
Sets-up a two dimensional multisample texture.
Definition: texture.hpp:1826
std::size_t size(void) const
Returns the size of the sequence.
Definition: seq_tpl.hpp:166
ObjectZero< DefaultTextureOps > DefaultTexture
An oglplus_object encapsulating the default texture functionality.
Definition: texture.hpp:3211
static GLsizei Height(Target target, GLint level=0)
Returns the height of the texture as it was specified by *Image*D.
Definition: texture.hpp:598
TextureWrap Wrap
Texture wrap mode value.
Definition: texture.hpp:556
void InvalidateImage(GLsizei level)
Invalidates the specified level of texture image.
Definition: texture.hpp:362
TextureMinFilter MinFilter
Minification filter.
Definition: texture.hpp:539
Forward declarations of Image-related classes.
static TextureSwizzle SwizzleA(Target target)
Gets the swizzle parameter (TEXTURE_SWIZZLE_A)
Definition: texture.hpp:2642
void BindImage(ImageUnitSelector unit, GLint level, bool layered, GLint layer, AccessSpecifier access, ImageUnitFormat format) const
Binds a level of this texture to an image unit.
Definition: texture.hpp:342
static void Image1D(Target target, GLint level, PixelDataInternalFormat internal_format, GLsizei width, GLint border, PixelDataFormat format, Property::PixDataType type, const void *data)
Specifies a one dimensional texture image.
Definition: texture.hpp:1278
TextureMagFilter
Texture magnification filter enumeration.
Definition: texture_filter.hpp:50
Implements operations applicable to named (non-zero) objects.
Definition: wrap_tpl.hpp:45
static void CompressedSubImage2D(Target target, GLint level, GLint xoffs, GLint yoffs, GLsizei width, GLsizei height, PixelDataFormat format, GLsizei image_size, const void *data)
Specifies a two dimensional compressed texture sub image.
Definition: texture.hpp:1719
TextureWrap
Texture wrap enumeration.
Definition: texture_wrap.hpp:51
GLuint GetGLName(ObjectName< ObjTag > named)
Returns the GLuint OpenGL name assigned to named object.
Definition: name.hpp:38
AccessSpecifier
Enumeration of access type specifiers.
Definition: access_specifier.hpp:27
TextureTarget
static TextureSwizzle SwizzleG(Target target)
Gets the swizzle parameter (TEXTURE_SWIZZLE_G)
Definition: texture.hpp:2594
static GLsizei StencilSize(Target target, GLint level=0)
Returns the actual resolution of the STENCIL component.
Definition: texture.hpp:834
PixelDataType
OpenGL pixel data type enumeration.
Definition: pixel_data.hpp:29
static bool Seamless(Target target)
Gets the seamless cubemap setting value.
Definition: texture.hpp:2916
static GLsizei SharedSize(Target target, GLint level=0)
Returns the size of all texture components.
Definition: texture.hpp:856
A tuple of swizzle values for all texture components.
Definition: texture_swizzle.hpp:67
static void CopySubImage2D(Target target, GLint level, GLint xoffs, GLint yoffs, GLint x, GLint y, GLsizei width, GLsizei height)
Copies a two dimensional texture sub image from the framebuffer.
Definition: texture.hpp:1505
static void DepthStencilMode(Target target, PixelDataFormat mode)
Sets the depth stencil mode (DEPTH_STENCIL_TEXTURE_MODE)
Definition: texture.hpp:2889
OpenGL test/comparison function enumeration.
GLuint TextureTargetDimensions(TextureTarget target)
Function returning the number of texture dimensions for a texture target.
Sequence of Object names.
static void Active(TextureUnitSelector index)
Specify active texture unit for subsequent commands.
Definition: texture.hpp:271
PixelDataFormat
OpenGL pixel data format enumeration.
Definition: pixel_data.hpp:50
TextureCompareMode
Texture compare mode enumeration.
Definition: texture_compare.hpp:29
static void WrapS(Target target, TextureWrap mode)
Sets the wrap parameter (TEXTURE_WRAP_S)
Definition: texture.hpp:2817
static void MaxLevel(Target target, GLint value)
Sets maximum level value (TEXTURE_MAX_LEVEL)
Definition: texture.hpp:2446
Helper macro for optional checking of availability of GL function.
ObjectOps< tag::ExplicitSel, tag::Texture > TextureOps
Texture operations with explicit selector.
Definition: texture.hpp:2998
static TextureWrap WrapT(Target target)
Gets the wrap parameter (TEXTURE_WRAP_T)
Definition: texture.hpp:2828
static Vector< GLint, 4 > BorderColor(Target target, TypeTag< GLint >)
Gets the texture border color (TEXTURE_BORDER_COLOR)
Definition: texture.hpp:2082
static GLsizei GreenSize(Target target, GLint level=0)
Returns the actual resolution of the GREEN component.
Definition: texture.hpp:750
const GLuint * GetGLNames(const Sequence< ObjName > &sequence)
Returns a pointer to array of GL object names stored in a sequence.
Definition: sequence.hpp:23
Texture magnification/minification filter enumerations.
Implements operations applicable to any object including object 0 (zero)
Definition: fwd.hpp:157
Data type-related declarations.
void ClearImage(GLsizei level, PixelDataFormat format, const GLtype *data)
Clears the specified level of texture image.
Definition: texture.hpp:416
static TextureWrap WrapR(Target target)
Gets the wrap parameter (TEXTURE_WRAP_R)
Definition: texture.hpp:2850
static GLint Active(void)
Returns active texture unit.
Definition: texture.hpp:291
static GLfloat MaxLOD(Target target)
Gets maximum LOD value (TEXTURE_MAX_LOD)
Definition: texture.hpp:2404
Pixel data-related declarations.
static PixelDataType RedType(Target target, GLint level=0)
Returns the data type used to store the RED component.
Definition: texture.hpp:628
static void BorderColor(Target target, Vector< GLint, 4 > color)
Sets the texture border color (TEXTURE_BORDER_COLOR)
Definition: texture.hpp:2104
TextureTarget
Texture bind and image specification targets.
Definition: texture_target.hpp:27
static void MaxLOD(Target target, GLfloat value)
Sets maximum LOD value (TEXTURE_MAX_LOD)
Definition: texture.hpp:2415
Stores a value having one of the listed types in a common representation.
Definition: one_of.hpp:60
static void CompressedImage1D(Target target, GLint level, PixelDataInternalFormat internal_format, GLsizei width, GLint border, GLsizei image_size, const void *data)
Specifies a one dimensional compressed texture image.
Definition: texture.hpp:1644
static void SubImage2D(Target target, GLint level, GLint xoffs, GLint yoffs, GLsizei width, GLsizei height, PixelDataFormat format, Property::PixDataType type, const void *data)
Specifies a two dimensional texture sub image.
Definition: texture.hpp:1227
static void WrapT(Target target, TextureWrap mode)
Sets the wrap parameter (TEXTURE_WRAP_T)
Definition: texture.hpp:2839
static void GetImage(Target target, GLint level, PixelDataFormat format, Property::PixDataType type, GLsizei size, GLvoid *buffer)
Allows to obtain the texture image in uncompressed form.
Definition: texture.hpp:935
static GLint MaxLevel(Target target)
Gets maximum level value (TEXTURE_MAX_LEVEL)
Definition: texture.hpp:2435
static void Anisotropy(Target target, GLfloat value)
Sets the anisotropy level.
Definition: texture.hpp:2504
static TextureSwizzleTuple SwizzleRGBA(Target target)
Gets the swizzle parameter (TEXTURE_SWIZZLE_RGBA)
Definition: texture.hpp:2666
static void MinLOD(Target target, GLfloat value)
Sets minimal LOD value (TEXTURE_MIN_LOD)
Definition: texture.hpp:2384
static Vector< GLfloat, 4 > BorderColor(Target target, TypeTag< GLfloat >)
Gets the texture border color (TEXTURE_BORDER_COLOR)
Definition: texture.hpp:2040
static TextureMagFilter MagFilter(Target target)
Gets the magnification filter (TEXTURE_MAG_FILTER)
Definition: texture.hpp:2303
static void Image2D(Target target, GLint level, PixelDataInternalFormat internal_format, GLsizei width, GLsizei height, GLint border, PixelDataFormat format, Property::PixDataType type, const void *data)
Specifies a two dimensional texture image.
Definition: texture.hpp:1111
static void BufferRange(Target target, PixelDataInternalFormat internal_format, BufferName buffer, GLintptr offset, GLsizeiptr size)
Assigns a buffer range storing the texel data to the texture.
Definition: texture.hpp:1887
static void SwizzleRGBA(Target target, TextureSwizzle mode_r, TextureSwizzle mode_g, TextureSwizzle mode_b, TextureSwizzle mode_a)
Sets the RGBA swizzle parameters (TEXTURE_SWIZZLE_RGBA)
Definition: texture.hpp:2714
Wrapper for (texture) image data.
Definition: image.hpp:45
static GLsizei RedSize(Target target, GLint level=0)
Returns the actual resolution of the RED component.
Definition: texture.hpp:729
Exception class for general OpenGL errors.
Definition: basic.hpp:43
Exception class for GL object-related errors.
Definition: object.hpp:24
Texture swizzle-related classes and enumerations.
static void Buffer(Target target, PixelDataInternalFormat internal_format, BufferName buffer)
Assigns a buffer storing the texel data to the texture.
Definition: texture.hpp:1859
static GLsizei DepthSize(Target target, GLint level=0)
Returns the actual resolution of the DEPTH component.
Definition: texture.hpp:813
static void CopyImage2D(Target target, GLint level, PixelDataInternalFormat internal_format, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
Copies a two dimensional texture image from the framebuffer.
Definition: texture.hpp:1399
static void SwizzleRGBA(Target target, TextureSwizzle mode)
Sets the RGBA swizzle parameter (TEXTURE_SWIZZLE_RGBA)
Definition: texture.hpp:2689
void View(Target target, TextureName orig_texture, PixelDataInternalFormat internal_format, GLuint min_level, GLuint num_levels, GLuint min_layer, GLuint num_layers)
References and reinteprets a subset of the data of another texture.
Definition: texture.hpp:485
static void ImageCM(GLuint face, GLint level, PixelDataInternalFormat internal_format, GLsizei width, GLsizei height, GLint border, PixelDataFormat format, Property::PixDataType type, const void *data)
Specifies the image of the specified cube-map face.
Definition: texture.hpp:1168
TextureCompareMode CompareMode
Depth texture comparison mode.
Definition: texture.hpp:530
static void Image3DMultisample(Target target, GLsizei samples, PixelDataInternalFormat internal_format, GLsizei width, GLsizei height, GLsizei depth, bool fixed_sample_locations)
Sets-up a three dimensional multisample texture.
Definition: texture.hpp:1793
static void Swizzle(Target target, TextureSwizzleCoord coord, TextureSwizzle mode)
Sets the swizzle parameter (TEXTURE_SWIZZLE_*)
Definition: texture.hpp:2544
static void BorderColor(Target target, Vector< GLuint, 4 > color)
Sets the texture border color (TEXTURE_BORDER_COLOR)
Definition: texture.hpp:2146
static GLuint BaseLevel(Target target)
Returns the texture base level (TEXTURE_BASE_LEVEL)
Definition: texture.hpp:2007
static void SwizzleR(Target target, TextureSwizzle mode)
Sets the swizzle parameter (TEXTURE_SWIZZLE_R)
Definition: texture.hpp:2582
static TextureSwizzle Swizzle(Target target, TextureSwizzleCoord coord)
Gets the swizzle parameter (TEXTURE_SWIZZLE_*)
Definition: texture.hpp:2530
ImageUnitFormat
OpenGL image unit format enumeration.
Definition: pixel_data.hpp:104
TextureSwizzleCoord
Texture swizzle parameter coordinate enumeration.
Definition: texture_swizzle.hpp:29
void Bind(Target target) const
Binds this texture to the specified target.
Definition: texture.hpp:330
static void CopyImage1D(Target target, GLint level, PixelDataInternalFormat internal_format, GLint x, GLint y, GLsizei width, GLint border)
Copies a one dimensional texture image from the framebuffer.
Definition: texture.hpp:1435
static void Image3D(Target target, GLint level, PixelDataInternalFormat internal_format, GLsizei width, GLsizei height, GLsizei depth, GLint border, PixelDataFormat format, Property::PixDataType type, const void *data)
Specifies a three dimensional texture image.
Definition: texture.hpp:1005
TextureWrapCoord
Texture wrap parameter coordinate enumeration.
Definition: texture_wrap.hpp:28
static PixelDataType DepthType(Target target, GLint level=0)
Returns the data type used to store the DEPTH component.
Definition: texture.hpp:708
void InvalidateSubImage(GLsizei level, GLint xoffs, GLint yoffs, GLint zoffs, GLsizei width, GLsizei height, GLsizei depth)
Invalidates the specified part of texture image.
Definition: texture.hpp:379
Type for the texture unit selector (implementation-dependent limited) number.
Definition: texture_unit.hpp:22
Implements operations applicable to any object and any operation kind.
Definition: fwd.hpp:151
static void Storage2D(Target target, GLsizei levels, PixelDataInternalFormat internal_format, GLsizei width, GLsizei height)
Specifies all levels of 2D texture at the same time.
Definition: texture.hpp:1946
CompareFunction
Comparison function type enumeration.
Definition: compare_function.hpp:30
static TextureWrap Wrap(Target target, TextureWrapCoord coord)
Gets the wrap parameter (TEXTURE_WRAP_*)
Definition: texture.hpp:2768
static void SwizzleG(Target target, TextureSwizzle mode)
Sets the swizzle parameter (TEXTURE_SWIZZLE_G)
Definition: texture.hpp:2606
static GLfloat MaxAnisotropy(Target target)
Gets the maximum anisotropy level.
Definition: texture.hpp:2466
TextureTarget Target
Texture bind targets.
Definition: texture.hpp:113
Object wrapping buffer to store output data.
static PixelDataType BlueType(Target target, GLint level=0)
Returns the data type used to store the BLUE component.
Definition: texture.hpp:668
Basic template for vector types.
Definition: fwd.hpp:43
Texture and image unit selectors.
TextureFilter Filter
Filter.
Definition: texture.hpp:533
static PixelDataType GreenType(Target target, GLint level=0)
Returns the data type used to store the GREEN component.
Definition: texture.hpp:648
A common template for "named" objects like textures, buffers, etc.
Definition: fwd.hpp:136
static GLsizei Depth(Target target, GLint level=0)
Returns the depth of the texture as it was specified by *Image*D.
Definition: texture.hpp:612
A vector class.
static GLsizei BlueSize(Target target, GLint level=0)
Returns the actual resolution of the BLUE component.
Definition: texture.hpp:771
static void CopySubImage3D(Target target, GLint level, GLint xoffs, GLint yoffs, GLint zoffs, GLint x, GLint y, GLsizei width, GLsizei height)
Copies a three dimensional texture sub image from the framebuffer.
Definition: texture.hpp:1469
static PixelDataType AlphaType(Target target, GLint level=0)
Returns the data type used to store the ALPHA component.
Definition: texture.hpp:688
Texture target enumeration.
static void LODBias(Target target, GLfloat value)
Sets the LOD bias value (TEXTURE_LOD_BIAS)
Definition: texture.hpp:2249
static Target CubeMapFace(GLuint face)
Returns the target for the i-th cube map face (0-5)
Definition: texture.hpp:314
Variant helper class used mostly with enums.
static void Image(Target target, const images::Image &image, GLint level=0, GLint border=0)
Specifies a texture image.
static TextureMinFilter MinFilter(Target target)
Gets the minification filter (TEXTURE_MIN_FILTER)
Definition: texture.hpp:2338
Selector type used with the syntax sugar operators.
Definition: texture.hpp:3002
static GLsizei Width(Target target, GLint level=0)
Returns the width of the texture as it was specified by *Image*D.
Definition: texture.hpp:584

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