nCine::GLShaderProgram class

Handles OpenGL shader programs.

Public types

enum class Introspection { Enabled, NoUniformsInBlocks, Disabled }
enum class Status { NotLinked, CompilationFailed, LinkingFailed, Linked, LinkedWithDeferredQueries, LinkedWithIntrospection }
enum class QueryPhase { Immediate, Deferred }

Public static variables

static std::int32_t DefaultBatchSize constexpr

Constructors, destructors, conversion operators

GLShaderProgram()
GLShaderProgram(QueryPhase queryPhase) explicit
GLShaderProgram(StringView vertexFile, StringView fragmentFile, Introspection introspection, QueryPhase queryPhase)
GLShaderProgram(StringView vertexFile, StringView fragmentFile, Introspection introspection)
GLShaderProgram(StringView vertexFile, StringView fragmentFile)
~GLShaderProgram()
GLShaderProgram(const GLShaderProgram&) deleted

Public functions

auto operator=(const GLShaderProgram&) -> GLShaderProgram& deleted
auto glHandle() const -> GLuint
auto status() const -> Status
auto introspection() const -> Introspection
auto queryPhase() const -> QueryPhase
auto batchSize() const -> unsigned int
void setBatchSize(int value)
auto isLinked() const -> bool
auto retrieveInfoLogLength() const -> unsigned int
Returns the length of the information log including the null termination character.
void retrieveInfoLog(std::string& infoLog) const
Retrieves the information log and copies it in the provided string object.
auto uniformsSize() const -> unsigned int
Returns the total memory needed for all uniforms outside of blocks.
auto uniformBlocksSize() const -> unsigned int
Returns the total memory needed for all uniforms inside of blocks.
auto attachShaderFromFile(GLenum type, StringView filename) -> bool
auto attachShaderFromString(GLenum type, StringView string) -> bool
auto attachShaderFromStrings(GLenum type, ArrayView<const StringView> strings) -> bool
auto attachShaderFromStringsAndFile(GLenum type, ArrayView<const StringView> strings, StringView filename) -> bool
auto link(Introspection introspection) -> bool
void use()
auto validate() -> bool
auto finalizeAfterLinking(Introspection introspection) -> bool
auto numAttributes() const -> unsigned int
auto hasAttribute(const char* name) const -> bool
auto attribute(const char* name) -> GLVertexFormat::Attribute*
void defineVertexFormat(const GLBufferObject* vbo)
void defineVertexFormat(const GLBufferObject* vbo, const GLBufferObject* ibo)
void defineVertexFormat(const GLBufferObject* vbo, const GLBufferObject* ibo, unsigned int vboOffset)
void reset()
Deletes the current OpenGL shader program so that new shaders can be attached.
void setObjectLabel(const char* label)
auto logOnErrors() const -> bool
Returns the automatic log on errors flag.
void setLogOnErrors(bool shouldLogOnErrors)
Sets the automatic log on errors flag.

Function documentation

void nCine::GLShaderProgram::setLogOnErrors(bool shouldLogOnErrors)

Sets the automatic log on errors flag.

If the flag is true the shader program will automatically log compilation and linking errors.