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 GetGLHandle() const -> GLuint
auto GetStatus() const -> Status
auto GetIntrospection() const -> Introspection
auto GetQueryPhase() const -> QueryPhase
auto GetBatchSize() const -> std::uint32_t
void SetBatchSize(std::uint32_t value)
auto IsLinked() const -> bool
auto RetrieveInfoLogLength() const -> std::uint32_t
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 GetUniformsSize() const -> std::uint32_t
Returns the total memory needed for all uniforms outside of blocks.
auto GetUniformBlocksSize() const -> std::uint32_t
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 GetAttributeCount() const -> std::uint32_t
auto HasAttribute(const char* name) const -> bool
auto GetAttribute(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, std::uint32_t vboOffset)
void Reset()
Deletes the current OpenGL shader program so that new shaders can be attached.
void SetObjectLabel(const char* label)
auto GetLogOnErrors() 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.