CG_Labs 2021.2
Loading...
Searching...
No Matches
opengl.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <glad/glad.h>
4#include <GLFW/glfw3.h>
5
6#include <string>
7#include <vector>
8
9
10namespace utils
11{
12
13namespace opengl
14{
15
16namespace debug
17{
18
19bool isSupported();
20std::string getStringForType(GLenum type);
21std::string getStringForSource(GLenum source);
22std::string getStringForSeverity(GLenum severity);
23
35void beginDebugGroup(std::string const& message, GLuint id = 0u);
36
40void endDebugGroup();
41
53void nameObject(GLenum type, GLuint id, std::string const& label);
54
55void
56#ifdef _WIN32
57APIENTRY
58#endif
59opengl_error_callback( GLenum source, GLenum type, GLuint id
60 , GLenum severity, GLsizei /*length*/
61 , GLchar const* msg, void const* /*data*/
62 );
63
64} // end of namespace debug
65
66namespace shader
67{
68
69bool source_and_build_shader(GLuint id, std::string const& source);
70GLuint generate_shader(GLenum type, std::string const& source);
71bool link_program(GLuint id);
72void reload_program(GLuint id, std::vector<GLuint> const& ids, std::vector<std::string> const& sources);
73GLuint generate_program(std::vector<GLuint> const& shaders_id);
74
75} // end of namespace shader
76
77namespace fullscreen
78{
79
80void init(std::string const& vs_path, std::string const& fs_path, size_t width, size_t height);
81void deinit();
82void draw();
83GLuint get_texture_id();
84
85} // end of namespace fullscreen
86
87} // end of namespace opengl
88
89} // end of namespace utils
GLuint shader
Definition helpers.cpp:23
void beginDebugGroup(std::string const &message, GLuint id)
Start a new debug group.
Definition opengl.cpp:97
std::string getStringForSeverity(GLenum severity)
Definition opengl.cpp:79
bool isSupported()
Definition opengl.cpp:21
void nameObject(GLenum type, GLuint id, std::string const &label)
Label an OpenGL object with a custon string.
Definition opengl.cpp:115
std::string getStringForSource(GLenum source)
Definition opengl.cpp:56
std::string getStringForType(GLenum type)
Definition opengl.cpp:27
void opengl_error_callback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei, GLchar const *msg, void const *)
Definition opengl.cpp:127
void endDebugGroup()
End the most recently-started debug group.
Definition opengl.cpp:106
void deinit()
Definition opengl.cpp:331
void init(std::string const &vs_path, std::string const &fs_path, size_t width, size_t height)
Definition opengl.cpp:287
GLuint get_texture_id()
Definition opengl.cpp:366
void draw()
Definition opengl.cpp:372
void reload_program(GLuint id, std::vector< GLuint > const &ids, std::vector< std::string > const &sources)
Definition opengl.cpp:251
bool source_and_build_shader(GLuint id, std::string const &source)
Definition opengl.cpp:168
GLuint generate_program(std::vector< GLuint > const &shaders_id)
Definition opengl.cpp:260
bool link_program(GLuint id)
Definition opengl.cpp:219
GLuint generate_shader(GLenum type, std::string const &source)
Definition opengl.cpp:205
Definition opengl.cpp:13