globjects  2.0.0.630135941c42
Strict OpenGL objects wrapper.
Loading...
Searching...
No Matches
StateSetting.h
Go to the documentation of this file.
1
2#pragma once
3
4
5#include <functional>
6#include <set>
7#include <memory>
8
9#include <glbinding/gl/types.h>
10
11#include <globjects/globjects_api.h>
12
14
15
16namespace globjects
17{
18
19
20class AbstractFunctionCall;
21
22
23class GLOBJECTS_API StateSettingType
24{
25public:
27 StateSettingType(void * functionIdentifier);
28
29 bool operator==(const StateSettingType & other) const;
30 std::size_t hash() const;
31
32 void specializeType(gl::GLenum subtype);
33
34
35protected:
37 std::set<gl::GLenum> m_subtypes;
38};
39
40
41class GLOBJECTS_API StateSetting : public Instantiator<StateSetting>
42{
43public:
44 template <typename... Arguments>
45 StateSetting(void (*function)(Arguments...), Arguments... arguments);
46
47 virtual ~StateSetting();
48
49 void apply();
50
52 const StateSettingType & type() const;
53
54
55protected:
56 std::unique_ptr<AbstractFunctionCall> m_functionCall;
58
59
60protected:
61 StateSetting(std::unique_ptr<AbstractFunctionCall> && functionCall);
62};
63
64} // namespace globjects
65
66
67namespace std
68{
69
70
71template <>
72struct GLOBJECTS_API hash<globjects::StateSettingType>
73{
74 size_t operator()(const globjects::StateSettingType & type) const;
75};
76
77
78} // namespace globjects
79
80
81#include <globjects/StateSetting.inl>
CRTP for creating objects similar to std::make_unique.
Definition Instantiator.h:22
Definition StateSetting.h:42
std::unique_ptr< AbstractFunctionCall > m_functionCall
Definition StateSetting.h:56
StateSettingType m_type
Definition StateSetting.h:57
StateSettingType & type()
StateSetting(void(*function)(Arguments...), Arguments... arguments)
StateSetting(std::unique_ptr< AbstractFunctionCall > &&functionCall)
const StateSettingType & type() const
Definition StateSetting.h:24
std::set< gl::GLenum > m_subtypes
Definition StateSetting.h:37
std::size_t hash() const
void * m_functionIdentifier
Definition StateSetting.h:36
StateSettingType(void *functionIdentifier)
bool operator==(const StateSettingType &other) const
void specializeType(gl::GLenum subtype)
Contains all the classes that wrap OpenGL functionality.
Definition LocationIdentity.h:52
size_t operator()(const globjects::StateSettingType &type) const