27#define CHECKED_GL_CALL(func, ...) engine::graphics::OpenGL::call(std::source_location::current(), func, __VA_ARGS__)
49 template<
typename TResult,
typename... TOpenGLArgs,
typename... Args>
50 static TResult
call(std::source_location location, TResult (*glfun)(TOpenGLArgs...), Args... args) {
52 if constexpr (!std::is_same_v<TResult, void>) {
53 auto result = glfun(std::forward<Args>(args)...);
59 glfun(std::forward<Args>(args)...);
80 static uint32_t
generate_texture(
const std::filesystem::path &path,
bool flip_uvs);
Defines the Shader class that serves as an abstraction over OpenGL shaders.
This class serves as the OpenGL interface for your app, since the engine doesn't directly link OpenGL...
Definition OpenGL.hpp:36
static bool shader_compiled_successfully(uint32_t shader_id)
Check if the shader with the shader_id compiled successfully.
Definition OpenGL.cpp:80
static int32_t shader_type_to_opengl_type(resources::ShaderType type)
Converts resources::ShaderType to the OpenGL shader type enum.
Definition OpenGL.cpp:13
static void enable_depth_testing()
Enables depth testing.
Definition OpenGL.cpp:165
static TResult call(std::source_location location, TResult(*glfun)(TOpenGLArgs...), Args... args)
Performs a checked OpenGL call. If the OpenGL call fails, it throws util::OpenGLError.
Definition OpenGL.hpp:50
static int32_t texture_format(int32_t number_of_channels)
Get texture format for a number_of_channels.
Definition OpenGL.cpp:50
static void clear_buffers()
Clears GL_DEPTH_BUFFER_BIT, GL_COLOR_BUFFER_BIT, and GL_STENCIL_BUFFER_BIT.
Definition OpenGL.cpp:173
static void disable_depth_testing()
Disables depth testing.
Definition OpenGL.cpp:169
static uint32_t generate_texture(const std::filesystem::path &path, bool flip_uvs)
Loads the texture from path into the OpenGL context.
Definition OpenGL.cpp:22
static void assert_no_error(std::source_location location)
Throws util::OpenGLError if an OpenGL error occurred. Used internally.
Definition OpenGL.cpp:120
static std::string get_compilation_error_message(uint32_t shader_id)
Retrieve the shader compilation error log message.
Definition OpenGL.cpp:95
uint32_t ShaderProgramId
Definition OpenGL.hpp:38
static uint32_t init_skybox_cube()
Initializes the cube Vertex Array Object used for skybox drawing. Caches the vao result.
Definition OpenGL.cpp:59
static uint32_t compile_shader(const std::string &shader_source, resources::ShaderType shader_type)
Compiles the shader from source.
Definition OpenGL.cpp:86
static uint32_t load_skybox_textures(const std::filesystem::path &path, bool flip_uvs=false)
Loads the skybox textures from the path. Make sure that images are named: front.jpg,...
Definition OpenGL.cpp:130
Definition GraphicsController.hpp:14
ShaderType
The type of the shader.
Definition Shader.hpp:19