class glw::Program

Overview

Holds several compiled shaders which are used as a whole. More…

#include <ShaderProgram.h>

class Program {
public:
    // construction

    Program();
    ~Program();

    // methods

    static PProgram Create();
    bool AttachShader(const PShader& shader_ptr);
    bool Link();
    bool IsLinked() const;
    gl::GLuint GetID() const;
    std::string GetLinkLog() const;
    void Use() const;
    gl::GLint GetUniformLocation(const std::string& name) const;
    gl::GLint GetUniformBlockLocation(const std::string& name) const;
};

Detailed Documentation

Holds several compiled shaders which are used as a whole.

Construction

Program()

Creates shader program.

~Program()

Destroy program object and remove OpenGL references.

Methods

static PProgram Create()

Crates a program object and returns reference.

bool AttachShader(const PShader& shader_ptr)

Attaches a compiled shader to the program.

bool Link()

Links all attached Shader files and returns whether linking finished successfully.

bool IsLinked() const

Checks, whether last linking has finished successful.

gl::GLuint GetID() const

Returns OpenGL reference index.

std::string GetLinkLog() const

Returns log of last linking. When no errors nor warnings occurred, returned string is empty.

void Use() const

Use this program as OpenGL current.

gl::GLint GetUniformLocation(const std::string& name) const

Returns location of uniform variable with specified name.

gl::GLint GetUniformBlockLocation(const std::string& name) const

Returns location of uniform block with specified name.