sgltk 0.6
Simple OpenGL Tool Kit
Loading...
Searching...
No Matches
sgltk::App Class Reference

Handles library initialization and provides system information. More...

#include <app.h>

Collaboration diagram for sgltk::App:

Static Public Member Functions

static bool init ()
 Initializes SGLTK.
static void quit ()
 Deinitializes SGLTK.
static bool init_glew ()
 Initializes GLEW.
static bool init_img ()
 Initializes SDL2_img.
static void quit_img ()
 Deinitializes SDL2_img.
static bool init_sdl ()
 Initializes SDL2.
static void quit_sdl ()
 Deinitializes SDL2.
static void set_gl_version (int major, int minor)
 Sets the OpenGL version.
static void set_depth_stencil_size (int depth_size, int stencil_size)
 Sets the size of the depth and stencil buffers.
static void set_msaa_sample_number (int number_samples)
 Sets the number of samples used for multisample anti-aliasing.
static void enable_screensaver (bool enable)
 Enables the screensaver.
static bool enable_vsync (bool on)
 Turns VSync on or off.
static bool chdir_to_bin (char **argv)
 Changes the current working directory to the directory containing the executable.
static void get_sys_info ()
 Gathers system information and populates the sys_info attribute.
static void _check_error (std::string message, std::string file, unsigned int line)
 Outputs OpenGL error messages.

Static Public Attributes

static bool gl_version_manual = false
 True if set_gl_version was called, false otherwise.
static struct SYS_INFO sys_info
 System information.
static std::vector< std::string > error_string = {}
 A list of all error strings.

Detailed Description

Handles library initialization and provides system information.

Definition at line 133 of file app.h.

Member Function Documentation

◆ _check_error()

void App::_check_error ( std::string message,
std::string file,
unsigned int line )
static

Outputs OpenGL error messages.

Note
Dont't call this function directly, use check_gl_error(error_message) instead
See also
check_gl_error

Definition at line 181 of file app.cpp.

◆ chdir_to_bin()

bool App::chdir_to_bin ( char ** argv)
static

Changes the current working directory to the directory containing the executable.

Parameters
argvThe array of command line arguments passed to the main function
Returns
Returns true on success, false otherwise

Definition at line 158 of file app.cpp.

◆ enable_screensaver()

void App::enable_screensaver ( bool enable)
static

Enables the screensaver.

Parameters
enableTrue to enable or false to disable the screensaver

Definition at line 137 of file app.cpp.

◆ enable_vsync()

bool App::enable_vsync ( bool on)
static

Turns VSync on or off.

Parameters
onTrue turns VSync on, false turns it off
Returns
Returns false if VSync is not supported, true otherwise

Definition at line 144 of file app.cpp.

◆ get_sys_info()

void App::get_sys_info ( )
static

Gathers system information and populates the sys_info attribute.

Definition at line 217 of file app.cpp.

◆ init()

bool App::init ( )
static

Initializes SGLTK.

Returns
Returns true on success, false otherwise

Definition at line 64 of file app.cpp.

◆ init_glew()

bool App::init_glew ( )
static

Initializes GLEW.

Returns
Returns true on success, false otherwise

Definition at line 10 of file app.cpp.

◆ init_img()

bool App::init_img ( )
static

Initializes SDL2_img.

Returns
Returns true on success, false otherwise

Definition at line 19 of file app.cpp.

◆ init_sdl()

bool App::init_sdl ( )
static

Initializes SDL2.

Returns
Returns true on success, false otherwise

Definition at line 33 of file app.cpp.

◆ quit()

void App::quit ( )
static

Deinitializes SGLTK.

Definition at line 127 of file app.cpp.

◆ quit_img()

void App::quit_img ( )
static

Deinitializes SDL2_img.

Definition at line 29 of file app.cpp.

◆ quit_sdl()

void App::quit_sdl ( )
static

Deinitializes SDL2.

Definition at line 45 of file app.cpp.

◆ set_depth_stencil_size()

void App::set_depth_stencil_size ( int depth_size,
int stencil_size )
static

Sets the size of the depth and stencil buffers.

Parameters
depth_sizeThe minimum size of the depth buffer in bits
stencil_sizeThe minimum size of the stencil buffer in bits
Note
This function needs to be called before a window is created.

Definition at line 117 of file app.cpp.

◆ set_gl_version()

void App::set_gl_version ( int major,
int minor )
static

Sets the OpenGL version.

Parameters
majorThe major version number
minorThe minor version number
Note
This function needs to be called before a window is created. If the parameter combination is not valid, version defaults to 3.0

Definition at line 89 of file app.cpp.

◆ set_msaa_sample_number()

void App::set_msaa_sample_number ( int number_samples)
static

Sets the number of samples used for multisample anti-aliasing.

Parameters
number_samplesThe number of samples to be used

Definition at line 122 of file app.cpp.

Member Data Documentation

◆ error_string

std::vector< std::string > App::error_string = {}
static

A list of all error strings.

Definition at line 151 of file app.h.

◆ gl_version_manual

bool App::gl_version_manual = false
static

True if set_gl_version was called, false otherwise.

Definition at line 143 of file app.h.

◆ sys_info

struct SYS_INFO App::sys_info
static

System information.

Definition at line 147 of file app.h.


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