OpenGL helper functions.
More...
#include <gl.hpp>
|
| std::expected< void, subsystem::error > | initialize () override |
| |
| std::expected< void, subsystem::error > | terminate () override |
| |
| std::string | name () override |
| | Returns the name of the sybsystem.
|
| |
| bool | is_initialized () override |
| | Returns true if the subsystem is initialized.
|
| |
|
| static gl & | instance () |
| |
| static void | set_poligon_mode (GLboolean enable) |
| | Set Poligon Mode.
|
| |
| static void | set_viewport (int x, int y, int width, int height) |
| | Set Viewport.
|
| |
| static void | set_color (float r, float g, float b, float a) |
| | Set Clear Color.
|
| |
| static void | draw_arrays (GLenum mode, int first, int count) |
| | Draw Arrays.
|
| |
| static void | draw_elements (GLenum mode, int count, GLenum type, const void *indices) |
| | Draw Elements.
|
| |
| static void | clear () |
| | Clear.
|
| |
| static void | bind_vertex_array (unsigned int n) |
| |
| static GLenum | _check_error (const char *file, int line) |
| | Check OpenGL error.
|
| |
|
| using | error = std::string |
| |
OpenGL helper functions.
This class contains helper functions to interact with OpenGL.
Definition at line 29 of file gl.hpp.
◆ _check_error()
| GLenum gl::_check_error |
( |
const char * | file, |
|
|
int | line ) |
|
static |
Check OpenGL error.
This function checks if there is an OpenGL error.
- Returns
- The error code
Definition at line 180 of file gl.cpp.
◆ bind_vertex_array()
| void gl::bind_vertex_array |
( |
unsigned int | n | ) |
|
|
static |
◆ clear()
Clear.
This function clears the color and depth buffer.
Definition at line 175 of file gl.cpp.
◆ draw_arrays()
| void gl::draw_arrays |
( |
GLenum | mode, |
|
|
int | first, |
|
|
int | count ) |
|
static |
Draw Arrays.
This function draws primitives from the array data.
- Parameters
-
| mode | Specifies what kind of primitives to render |
| first | Specifies the starting index in the enabled arrays |
| count | Specifies the number of indices to be rendered |
Definition at line 160 of file gl.cpp.
◆ draw_elements()
| void gl::draw_elements |
( |
GLenum | mode, |
|
|
int | count, |
|
|
GLenum | type, |
|
|
const void * | indices ) |
|
static |
Draw Elements.
This function draws primitives from the array data.
- Parameters
-
| mode | Specifies what kind of primitives to render |
| count | Specifies the number of elements to be rendered |
| type | Specifies the type of the values in indices |
| indices | Specifies a pointer to the location where the indices are stored |
Definition at line 165 of file gl.cpp.
◆ initialize()
| std::expected< void, subsystem::error > gl::initialize |
( |
| ) |
|
|
overridevirtual |
◆ instance()
◆ is_initialized()
| bool gl::is_initialized |
( |
| ) |
|
|
overridevirtual |
◆ name()
◆ set_color()
| void gl::set_color |
( |
float | r, |
|
|
float | g, |
|
|
float | b, |
|
|
float | a ) |
|
static |
Set Clear Color.
This function sets the clear color of the window.
- Parameters
-
| r | Red component of the clear color |
| g | Green component of the clear color |
| b | Blue component of the clear color |
| a | Alpha component of the clear color |
Definition at line 155 of file gl.cpp.
◆ set_poligon_mode()
| void gl::set_poligon_mode |
( |
GLboolean | enable | ) |
|
|
static |
Set Poligon Mode.
- Parameters
-
| enable | Enable or disable poligon mode |
Definition at line 130 of file gl.cpp.
◆ set_viewport()
| void gl::set_viewport |
( |
int | x, |
|
|
int | y, |
|
|
int | width, |
|
|
int | height ) |
|
static |
Set Viewport.
This function sets the viewport of the window.
- Parameters
-
| x | X coordinate of the viewport |
| y | Y coordinate of the viewport |
| width | Width of the viewport |
| height | Height of the viewport |
Definition at line 150 of file gl.cpp.
◆ terminate()
| std::expected< void, subsystem::error > gl::terminate |
( |
| ) |
|
|
overridevirtual |
◆ default_config
Initial value:= {
false,
false,
false,
false,
}
Definition at line 37 of file gl.hpp.
◆ init_config
◆ subsystem_name
| const std::string gl::subsystem_name = "gl" |
|
static |
The documentation for this class was generated from the following files: