GLW
Computer Graphics Structures library
glw Namespace Reference

OpenGL wrapper library namespace. Provides simplified interface for using OpenGL features. More...

Data Structures

class  ArrayObject
 Class to store data arrays. Arrays can be later accessed by shaders when draw is requested. More...
 
struct  Attrib
 Array attribute. Defines how specific data are stored in combined buffer. For example how are vertex colors stored in array of vertex data. More...
 
class  FrameBuffer
 Class used to store buffers for internal rendering. More...
 
class  Program
 Holds several compiled shaders which are used as a whole. More...
 
class  Shader
 Maintains the source code strings that defines a shader. More...
 
class  Texture
 Basic texture type. More...
 
class  Texture2D
 Two dimensional texture. Used mostly to store color images or results of internal rendering. More...
 
class  Texture2dMultisample
 Similar to Texture2D, uses multi-sampling for anti-aliasing effects. More...
 
class  UniformBuffer
 Object to store global variables, arrays or structures and manipulate them. Type of elements inside the buffer must be defined as template type. More...
 
class  Window
 Implements GLFW functions in object style programming. More...
 
class  WindowEventObserver
 Any class derived from WindowEventObserver can receive Window events. More...
 

Typedefs

using Attrib1f = TAttrib< gl::GLenum::GL_FLOAT, 1 >
 
using Attrib2f = TAttrib< gl::GLenum::GL_FLOAT, 2 >
 
using Attrib3f = TAttrib< gl::GLenum::GL_FLOAT, 3 >
 
using Attrib4f = TAttrib< gl::GLenum::GL_FLOAT, 4 >
 
using Attrib1i = TAttrib< gl::GLenum::GL_INT, 1 >
 
using Attrib2i = TAttrib< gl::GLenum::GL_INT, 2 >
 
using Attrib3i = TAttrib< gl::GLenum::GL_INT, 3 >
 
using Attrib4i = TAttrib< gl::GLenum::GL_INT, 4 >
 
using PArrayObject = std::shared_ptr< class ArrayObject >
 
using PFrameBuffer = std::shared_ptr< class FrameBuffer >
 
using PShader = std::shared_ptr< class Shader >
 
using PProgram = std::shared_ptr< class Program >
 
using PProgramList = std::shared_ptr< class ProgramList >
 
using PTexture = std::shared_ptr< class Texture >
 
using PTexture2D = std::shared_ptr< class Texture2D >
 
using PTexture2dMultisample = std::shared_ptr< class Texture2dMultisample >
 
template<typename T >
using PUniformBuffer = std::shared_ptr< UniformBuffer< T > >
 

Enumerations

enum  DataUsage : uint32_t {
  stream_draw = uint32_t(gl::GLenum::GL_STREAM_DRAW), stream_read = uint32_t(gl::GLenum::GL_STREAM_READ), stream_copy = uint32_t(gl::GLenum::GL_STREAM_COPY), static_draw = uint32_t(gl::GLenum::GL_STATIC_DRAW),
  static_read = uint32_t(gl::GLenum::GL_STATIC_READ), static_copy = uint32_t(gl::GLenum::GL_STATIC_COPY), dynamic_draw = uint32_t(gl::GLenum::GL_DYNAMIC_DRAW), dynamic_read = uint32_t(gl::GLenum::GL_DYNAMIC_READ),
  dynamic_copy = uint32_t(gl::GLenum::GL_DYNAMIC_COPY)
}
 Hint to the GL implementation as to how a buffer object's data store will be accessed. More...
 
enum  DrawMode : uint32_t {
  points = uint32_t(gl::GLenum::GL_POINTS), lines = uint32_t(gl::GLenum::GL_LINES), line_strip = uint32_t(gl::GLenum::GL_LINE_STRIP), line_loop = uint32_t(gl::GLenum::GL_LINE_LOOP),
  triangles = uint32_t(gl::GLenum::GL_TRIANGLES), triangle_strip = uint32_t(gl::GLenum::GL_TRIANGLE_STRIP), triangle_fan = uint32_t(gl::GLenum::GL_TRIANGLE_FAN), patches = uint32_t(gl::GLenum::GL_PATCHES)
}
 Specifies what kind of primitives are rendered.
 
enum  ShaderType {
  vertex = (unsigned int)gl::GLenum::GL_VERTEX_SHADER, tess_ctrl = (unsigned int)gl::GLenum::GL_TESS_CONTROL_SHADER, tess_eval = (unsigned int)gl::GLenum::GL_TESS_EVALUATION_SHADER, geometry = (unsigned int)gl::GLenum::GL_GEOMETRY_SHADER,
  fragment = (unsigned int)gl::GLenum::GL_FRAGMENT_SHADER, compute = (unsigned int)gl::GLenum::GL_COMPUTE_SHADER, none = (unsigned int)gl::GLenum::GL_NONE
}
 Indicates the type of shader.
 
enum  Wrapping { Wrapping::repeat = uint32_t(gl::GLenum::GL_REPEAT), Wrapping::mirror_repeat = uint32_t(gl::GLenum::GL_MIRRORED_REPEAT), Wrapping::clamp = uint32_t(gl::GLenum::GL_CLAMP_TO_EDGE), Wrapping::border_color = uint32_t(gl::GLenum::GL_CLAMP_TO_BORDER) }
 
enum  Filtering {
  Filtering::nearest = uint32_t(gl::GLenum::GL_NEAREST), Filtering::linear = uint32_t(gl::GLenum::GL_LINEAR), Filtering::closest_mip_nearest = uint32_t(gl::GLenum::GL_NEAREST_MIPMAP_NEAREST), Filtering::closest_mip_linear = uint32_t(gl::GLenum::GL_LINEAR_MIPMAP_NEAREST),
  Filtering::inter_mip_nearest = uint32_t(gl::GLenum::GL_NEAREST_MIPMAP_LINEAR), Filtering::inter_mip_linear = uint32_t(gl::GLenum::GL_LINEAR_MIPMAP_LINEAR)
}
 Texture filtering types. Define how colors are pulled from texture image when picking from between multiple texel points. More...
 
enum  ColorType {
  ColorType::uint8_norm, ColorType::int8_norm, ColorType::uint16_norm, ColorType::int16_norm,
  ColorType::uint8, ColorType::int8, ColorType::uint16, ColorType::int16,
  ColorType::uint32, ColorType::int32, ColorType::float16, ColorType::float32
}
 
enum  DepthDataFormat { DepthDataFormat::uint16_norm = uint32_t(gl::GLenum::GL_DEPTH_COMPONENT16), DepthDataFormat::uint24_norm = uint32_t(gl::GLenum::GL_DEPTH_COMPONENT24), DepthDataFormat::float32 = uint32_t(gl::GLenum::GL_DEPTH_COMPONENT32F) }
 

Functions

GLW_API std::string GetShaderBuildDirectory ()
 Returns directory path where function BuildShader looks for shader files. Can be changed by calling SetShaderBuildDirectory.
 
GLW_API void SetShaderBuildDirectory (const std::string &directory)
 Changes directory path where function BuildShader looks for shader files.
 
GLW_API glw::PShader BuildShader (std::string filename, const glw::Shader::ReplaceMap replace_map)
 Builds shader file using extended build system, which supports file including, error checks, etc. More...
 
GLW_API glw::ShaderType GetShaderTypeFromFileName (const std::string &filename)
 Creates ShaderType from extension of specified shader file name.
 
GLW_API gl::GLenum ColorFormat (const ColorType color_data_type, const uint8_t channels)
 Creates OpenGL color format from desired data type per channel, and desired number of channels.
 
GLW_API bool IsOpenGLInitialized ()
 Returns true when OpenGL was initialized.
 
GLW_API std::string GetError ()
 Returns all errors generated by OpenGL since last time this function was called.
 
GLW_API std::string GetOpenGlVendor ()
 
GLW_API std::string GetOpenGlRenderer ()
 
GLW_API std::string GetOpenGlVersion ()
 
GLW_API utils::Version GetCurrentOpenGlVersion ()
 Get OpenGL version actually active on system.
 

Detailed Description

OpenGL wrapper library namespace. Provides simplified interface for using OpenGL features.

Enumeration Type Documentation

◆ ColorType

enum glw::ColorType
strong
Enumerator
uint8_norm 

range < 0.0, 1.0> internally represented as 8 bit unsigned integral number

int8_norm 

range <-1.0, 1.0> internally represented as 8 bit integral number

uint16_norm 

range < 0.0, 1.0> internally represented as 16 bit unsigned integral number

int16_norm 

range <-1.0, 1.0> internally represented as 16 bit integral number

uint8 

true 8 bit unsigned integral number

int8 

true 8 bit integral number

uint16 

true 16 bit unsigned integral number

int16 

true 16 bit integral number

uint32 

true 32 bit unsigned integral number

int32 

true 32 bit integral number

float16 

16 bit floating point number

float32 

32 bit floating point number

◆ DataUsage

enum glw::DataUsage : uint32_t
strong

Hint to the GL implementation as to how a buffer object's data store will be accessed.

The frequency of access may be one of these: STREAM - The data store contents will be modified once and used at most a few times. STATIC - The data store contents will be modified once and used many times. DYNAMIC - The data store contents will be modified repeatedly and used many times.

The nature of access may be one of these: DRAW - The data store contents are modified by the application, and used as the source for GL drawing and image specification commands. READ - The data store contents are modified by reading data from the GL, and used to return that data when queried by the application. COPY - The data store contents are modified by reading data from the GL, and used as the source for GL drawing and image specification commands.

◆ DepthDataFormat

enum glw::DepthDataFormat
strong
Enumerator
uint16_norm 

range < 0.0, 1.0> internally represented as 16 bit unsigned integral number

uint24_norm 

range < 0.0, 1.0> internally represented as 24 bit unsigned integral number

float32 

32 bit floating point number

◆ Filtering

enum glw::Filtering
strong

Texture filtering types. Define how colors are pulled from texture image when picking from between multiple texel points.

Enumerator
nearest 

takes nearest texel to the coordinate

linear 

linearly interpolates 4 nearest texels

closest_mip_nearest 

takes nearest from closest mipmap level

closest_mip_linear 

takes linear from closest mipmap level

inter_mip_nearest 

takes nearest from the 2 closest mipmaps and interpolates

inter_mip_linear 

takes linear from the 2 closest mipmaps and interpolates

◆ Wrapping

enum glw::Wrapping
strong
Enumerator
repeat 

repeats image as tiles

mirror_repeat 

repeats image but flips closest tiles

clamp 

colors around image are equal to the image edges

border_color 

colors around have color specified using GL_TEXTURE_BORDER_COLOR

Function Documentation

◆ BuildShader()

GLW_API glw::PShader glw::BuildShader ( std::string  filename,
const glw::Shader::ReplaceMap  replace_map 
)

Builds shader file using extended build system, which supports file including, error checks, etc.

Parameters
filenameName of shader file, which is looked for in directory set by SetShaderBuildDirectory.
replace_mapSearches for all occurrences of specified replacement pairs and replaces them.