OGLplus (0.52.0) a C++ wrapper for OpenGL

type_ops.hpp
Go to the documentation of this file.
1 
12 #pragma once
13 #ifndef OGLPLUS_PROG_VAR_TYPE_OPS_1405052234_HPP
14 #define OGLPLUS_PROG_VAR_TYPE_OPS_1405052234_HPP
15 
16 #include <oglplus/fwd.hpp>
17 #include <oglplus/string/ref.hpp>
18 #include <oglplus/object/name.hpp>
19 #include <oglplus/detail/glsl_to_cpp.hpp>
20 
21 namespace oglplus {
22 
23 // Tag template that can be used to declare an Uniform from SLDataType
24 template <oglplus::SLDataType>
25 struct SLtoCpp;
26 
27 template <typename T>
28 struct AdjustProgVar
29 {
30  typedef T BaseType;
31  typedef T ValueType;
32 
33  inline static BaseType Adjust(ValueType value)
34  {
35  return value;
36  }
37 };
38 
39 template <>
40 struct AdjustProgVar<void>
41 {
42  typedef void BaseType;
43 };
44 
45 template <>
46 struct AdjustProgVar<bool>
47 {
48  typedef GLboolean BaseType;
49  typedef bool ValueType;
50 
51  inline static BaseType Adjust(ValueType value)
52  {
53  return value?GL_TRUE:GL_FALSE;
54  }
55 };
56 
57 template <std::size_t N>
58 struct AdjustProgVar<oglplus::Vector<bool, N> >
59 {
60  typedef oglplus::Vector<GLboolean, N> BaseType;
61  typedef const oglplus::Vector<bool, N>& ValueType;
62 
63  inline static BaseType Adjust(ValueType value)
64  {
65  return BaseType(value);
66  }
67 };
68 
69 template <oglplus::SLDataType SLType>
70 struct AdjustProgVar<SLtoCpp<SLType> >
71 {
72  typedef typename aux::GLSL2Cpp<SLType>::Type BaseType;
73  typedef BaseType ValueType;
74 
75  inline static BaseType Adjust(ValueType value)
76  {
77  return value;
78  }
79 };
80 
81 template <>
82 class ProgVarTypeOps<tag::Uniform>
83 {
84 protected:
85  static GLenum GetType(ProgramName, GLint location, StrCRef identifier);
86 };
87 
88 } // namespace oglplus
89 
90 #endif // include guard
Forward declarations.
String reference.
String const reference wrapper template.
Definition: ref_tpl.hpp:72
Base class for OpenGL "named" objects.
Basic template for vector types.
Definition: fwd.hpp:43

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