OGLplus
(0.52.0)
a C++ wrapper for
OpenGL
Tweet
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
include
oglplus
opt
shader_literals.hpp
Go to the documentation of this file.
1
12
#pragma once
13
#ifndef OGLPLUS_OPT_SHADER_LITERALS_HPP
14
#define OGLPLUS_OPT_SHADER_LITERALS_HPP
15
16
#include <oglplus/config/compiler.hpp>
17
#include <
oglplus/shader.hpp
>
18
19
#if !OGLPLUS_NO_USER_DEFINED_LITERALS
20
21
namespace
oglplus {
22
namespace
aux {
23
24
inline
Shader
ShaderFromLiteral(
25
ShaderType
shader_type,
26
const
char
* lit,
27
size_t
size
28
)
29
{
30
Shader
shader(shader_type);
31
shader.Source(
StrCRef
(lit, size));
32
shader.Compile();
33
return
shader;
34
}
35
36
}
// namespace aux
37
38
#ifdef GL_VERTEX_SHADER
39
inline
Shader
operator
""
_glsl_vs(
const
char
* str,
size_t
size)
40
{
41
return
aux::ShaderFromLiteral(
ShaderType::Vertex
, str, size);
42
}
43
#endif
44
45
#ifdef GL_TESS_CONTROL_SHADER
46
inline
Shader
operator
""
_glsl_tcs(
const
char
* str,
size_t
size)
47
{
48
return
aux::ShaderFromLiteral(
ShaderType::TessControl
, str, size);
49
}
50
#endif
51
52
#ifdef GL_TESS_EVALUATION_SHADER
53
inline
Shader
operator
""
_glsl_tes(
const
char
* str,
size_t
size)
54
{
55
return
aux::ShaderFromLiteral(
ShaderType::TessEvaluation
, str, size);
56
}
57
#endif
58
59
#ifdef GL_GEOMETRY_SHADER
60
inline
Shader
operator
""
_glsl_gs(
const
char
* str,
size_t
size)
61
{
62
return
aux::ShaderFromLiteral(
ShaderType::Geometry
, str, size);
63
}
64
#endif
65
66
#ifdef GL_FRAGMENT_SHADER
67
inline
Shader
operator
""
_glsl_fs(
const
char
* str,
size_t
size)
68
{
69
return
aux::ShaderFromLiteral(
ShaderType::Fragment
, str, size);
70
}
71
#endif
72
73
#ifdef GL_COMPUTE_SHADER
74
inline
Shader
operator
""
_glsl_cs(
const
char
* str,
size_t
size)
75
{
76
return
aux::ShaderFromLiteral(
ShaderType::Compute
, str, size);
77
}
78
#endif
79
80
}
// namespace oglplus
81
82
#else
83
#error "User-defined literals are required!"
84
#endif // OGLPLUS_NO_USER_DEFINED_LITERALS
85
86
#endif // include guard
oglplus::ObjectType::Shader
SHADER.
oglplus::ShaderType
ShaderType
The type of a Shader.
Definition:
shader_type.hpp:26
shader.hpp
Shader wrappers.
oglplus::ShaderType::Compute
COMPUTE_SHADER.
oglplus::ShaderType::Fragment
FRAGMENT_SHADER.
oglplus::ShaderType::Vertex
VERTEX_SHADER.
oglplus::ShaderType::TessControl
TESS_CONTROL_SHADER.
oglplus::StrCRef
StrCRefTpl< GLchar > StrCRef
String const reference wrapper.
Definition:
ref.hpp:21
oglplus::ShaderType::TessEvaluation
TESS_EVALUATION_SHADER.
oglplus::ShaderType::Geometry
GEOMETRY_SHADER.
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).