-
Notifications
You must be signed in to change notification settings - Fork 0
/
Graphics.tpp
56 lines (43 loc) · 1.27 KB
/
Graphics.tpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef GRAPHICS_TEMPLATE
#define GRAPHICS_TEMPLATE
#ifdef GL_API_GLAD_OPENGL_3
#ifdef WINDOW_API_GLFW
template <typename type>
type Graphics::GetData() {
return GetData<type>(data);
}
template <typename type>
type Graphics::GetData(std::any data) {
return std::any_cast<type>(data);
}
template <typename type>
void Graphics::SetWindowPointer(type* ptr) {
SetWindowPointer<type>(window, ptr);
}
template <typename type>
void Graphics::SetWindowPointer(GLFWwindow* window, type* ptr) {
glfwSetWindowUserPointer(window, ptr);
}
template <typename type>
type* Graphics::GetWindowPointer() {
return GetWindowPointer<type*>(window);
}
template <typename type>
type* Graphics::GetWindowPointer(GLFWwindow* window) {
return static_cast<type*>(glfwGetWindowUserPointer(window));
}
template <typename type>
type* GetPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum pixelsType) {
type* pixels;
glReadPixels(x, y, width, height, format, pixelsType, pixels);
return pixels;
}
template <typename type>
type* GetPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum pixelsType, GLsizei size) {
type* pixels;
glReadnPixels(x, y, width, height, format, pixelsType, size, pixels);
return pixels;
}
#endif
#endif
#endif