namespace glw — HIRO 0.7.0 documentation

# namespace glw

## Overview

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

    namespace glw {

    // typedefs

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

    // enums

    enum ColorType;
    enum DataUsage;
    enum DepthDataFormat;
    enum DrawMode;
    enum Filtering;
    enum ShaderType;
    enum Wrapping;

    // structs

    struct Attrib;
    struct ShaderPipeline;

    template <gl::GLenum T, uint32_t N>
    struct TAttrib;

    // classes

    class ArrayObject;
    class FrameBuffer;
    class HiddenWindow;
    class Program;
    class ProgramList;
    class Shader;
    class Texture;
    class Texture2D;
    class Texture2dMultisample;

    template <typename T>
    class UniformBuffer;

    class Window;
    class WindowEventObserver;

    // global functions

    GLW_API std::string GetShaderBuildDirectory();
    GLW_API void SetShaderBuildDirectory(const std::string& directory);
    GLW_API glw::PShader BuildShader(std::string filename, const glw::Shader::ReplaceMap replace_map);
    GLW_API glw::ShaderType GetShaderTypeFromFileName(const std::string& filename);
    GLW_API gl::GLenum ColorFormat(const ColorType color_data_type, const uint8_t channels);
    GLW_API bool IsOpenGLInitialized();
    GLW_API std::string GetError();
    GLW_API std::string GetOpenGlVendor();
    GLW_API std::string GetOpenGlRenderer();
    GLW_API std::string GetOpenGlVersion();
    GLW_API utils::Version GetCurrentOpenGlVersion();
    glw::PTexture2D SumDiffTextures(const glw::PTexture2D& texture1, const glw::PTexture2D& texture2, const glw::FrameBuffer::Settings& framebuffer_settings, const bool summation);
    glw::PTexture2D SumTextures(const glw::PTexture2D& texture1, const glw::PTexture2D& texture2, const glw::FrameBuffer::Settings& framebuffer_settings);
    glw::PTexture2D DiffTextures(const glw::PTexture2D& texture1, const glw::PTexture2D& texture2, const glw::FrameBuffer::Settings& framebuffer_settings);

    } // namespace glw

## Detailed Documentation

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

### Global 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.

Parameters:

filename | Name of shader file, which is looked for in directory set by SetShaderBuildDirectory.
replace_map | Searches for all occurrences of specified replacement pairs and replaces them.

    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 utils::Version GetCurrentOpenGlVersion()

Get OpenGL version actually active on system.