Brenta Engine 1.2
Loading...
Searching...
No Matches
brenta::gl Class Reference

OpenGL helper functions. More...

#include <gl.hpp>

Inheritance diagram for brenta::gl:
brenta::subsystem

Data Structures

class  builder
 
struct  config
 

Public Member Functions

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.
 
- Public Member Functions inherited from brenta::subsystem

Static Public Member Functions

static glinstance ()
 
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.
 

Static Public Attributes

static const std::string subsystem_name = "gl"
 
static const gl::config default_config
 
static gl::config init_config = default_config
 

Additional Inherited Members

- Public Types inherited from brenta::subsystem
using error = std::string
 

Detailed Description

OpenGL helper functions.

This class contains helper functions to interact with OpenGL.

Definition at line 29 of file gl.hpp.

Member Function Documentation

◆ _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

Definition at line 170 of file gl.cpp.

◆ clear()

void gl::clear ( )
static

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
modeSpecifies what kind of primitives to render
firstSpecifies the starting index in the enabled arrays
countSpecifies 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
modeSpecifies what kind of primitives to render
countSpecifies the number of elements to be rendered
typeSpecifies the type of the values in indices
indicesSpecifies 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

Implements brenta::subsystem.

Definition at line 42 of file gl.cpp.

◆ instance()

gl & gl::instance ( )
static

Definition at line 144 of file gl.cpp.

◆ is_initialized()

bool gl::is_initialized ( )
overridevirtual

Returns true if the subsystem is initialized.

Implements brenta::subsystem.

Definition at line 121 of file gl.cpp.

◆ name()

std::string gl::name ( )
overridevirtual

Returns the name of the sybsystem.

Implements brenta::subsystem.

Definition at line 116 of file gl.cpp.

◆ 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
rRed component of the clear color
gGreen component of the clear color
bBlue component of the clear color
aAlpha 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
enableEnable 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
xX coordinate of the viewport
yY coordinate of the viewport
widthWidth of the viewport
heightHeight of the viewport

Definition at line 150 of file gl.cpp.

◆ terminate()

std::expected< void, subsystem::error > gl::terminate ( )
overridevirtual

Implements brenta::subsystem.

Definition at line 107 of file gl.cpp.

Field Documentation

◆ default_config

const gl::config gl::default_config
static
Initial value:
= {
false,
false,
false,
false,
}

Definition at line 37 of file gl.hpp.

◆ init_config

gl::config gl::init_config = default_config
static

Definition at line 38 of file gl.hpp.

◆ subsystem_name

const std::string gl::subsystem_name = "gl"
static

Definition at line 36 of file gl.hpp.


The documentation for this class was generated from the following files: