nCine::Shader class

Shader.

Base classes

class Object
Base class of nCine objects.

Public types

enum class LoadMode { String, File }
enum class Introspection { Enabled, NoUniformsInBlocks, Disabled }
enum class DefaultVertex { SPRITE, SPRITE_NOTEXTURE, MESHSPRITE, MESHSPRITE_NOTEXTURE, BATCHED_SPRITES, BATCHED_SPRITES_NOTEXTURE, BATCHED_MESHSPRITES, BATCHED_MESHSPRITES_NOTEXTURE }
enum class DefaultFragment { SPRITE, SPRITE_NOTEXTURE }

Public static functions

static auto sType() -> ObjectType

Constructors, destructors, conversion operators

Shader()
Shader(const char* shaderName, LoadMode loadMode, Introspection introspection, const char* vertex, const char* fragment, std::int32_t batchSize = GLShaderProgram::DefaultBatchSize)
Shader(const char* shaderName, LoadMode loadMode, const char* vertex, const char* fragment, std::int32_t batchSize = GLShaderProgram::DefaultBatchSize)
Shader(LoadMode loadMode, const char* vertex, const char* fragment, std::int32_t batchSize = GLShaderProgram::DefaultBatchSize)
Shader(const char* shaderName, LoadMode loadMode, Introspection introspection, DefaultVertex vertex, const char* fragment, std::int32_t batchSize = GLShaderProgram::DefaultBatchSize)
Shader(const char* shaderName, LoadMode loadMode, DefaultVertex vertex, const char* fragment, std::int32_t batchSize = GLShaderProgram::DefaultBatchSize)
Shader(LoadMode loadMode, DefaultVertex vertex, const char* fragment, std::int32_t batchSize = GLShaderProgram::DefaultBatchSize)
Shader(const char* shaderName, LoadMode loadMode, Introspection introspection, const char* vertex, DefaultFragment fragment, std::int32_t batchSize = GLShaderProgram::DefaultBatchSize)
Shader(const char* shaderName, LoadMode loadMode, const char* vertex, DefaultFragment fragment, std::int32_t batchSize = GLShaderProgram::DefaultBatchSize)
Shader(LoadMode loadMode, const char* vertex, DefaultFragment fragment, std::int32_t batchSize = GLShaderProgram::DefaultBatchSize)
~Shader() override
Shader(const Shader&) deleted

Public functions

auto operator=(const Shader&) -> Shader& deleted
auto loadFromMemory(const char* shaderName, Introspection introspection, const char* vertex, const char* fragment, std::int32_t batchSize = GLShaderProgram::DefaultBatchSize, ArrayView<const StringView> defines = {}) -> bool
auto loadFromMemory(const char* shaderName, const char* vertex, const char* fragment, std::int32_t batchSize = GLShaderProgram::DefaultBatchSize) -> bool
auto loadFromMemory(const char* vertex, const char* fragment, std::int32_t batchSize = GLShaderProgram::DefaultBatchSize) -> bool
auto loadFromMemory(const char* shaderName, Introspection introspection, DefaultVertex vertex, const char* fragment, std::int32_t batchSize = GLShaderProgram::DefaultBatchSize, ArrayView<const StringView> defines = {}) -> bool
auto loadFromMemory(const char* shaderName, DefaultVertex vertex, const char* fragment, std::int32_t batchSize = GLShaderProgram::DefaultBatchSize) -> bool
auto loadFromMemory(DefaultVertex vertex, const char* fragment, std::int32_t batchSize = GLShaderProgram::DefaultBatchSize) -> bool
auto loadFromMemory(const char* shaderName, Introspection introspection, const char* vertex, DefaultFragment fragment, std::int32_t batchSize = GLShaderProgram::DefaultBatchSize, ArrayView<const StringView> defines = {}) -> bool
auto loadFromMemory(const char* shaderName, const char* vertex, DefaultFragment fragment, std::int32_t batchSize = GLShaderProgram::DefaultBatchSize) -> bool
auto loadFromMemory(const char* vertex, DefaultFragment fragment, std::int32_t batchSize = GLShaderProgram::DefaultBatchSize) -> bool
auto loadFromFile(const char* shaderName, Introspection introspection, StringView vertexPath, StringView fragmentPath, std::int32_t batchSize = GLShaderProgram::DefaultBatchSize, ArrayView<const StringView> defines = {}) -> bool
auto loadFromFile(const char* shaderName, StringView vertexPath, StringView fragmentPath, std::int32_t batchSize = GLShaderProgram::DefaultBatchSize) -> bool
auto loadFromFile(StringView vertexPath, StringView fragmentPath, std::int32_t batchSize = GLShaderProgram::DefaultBatchSize) -> bool
auto loadFromFile(const char* shaderName, Introspection introspection, DefaultVertex vertex, StringView fragmentPath, std::int32_t batchSize = GLShaderProgram::DefaultBatchSize, ArrayView<const StringView> defines = {}) -> bool
auto loadFromFile(const char* shaderName, DefaultVertex vertex, StringView fragmentPath, std::int32_t batchSize = GLShaderProgram::DefaultBatchSize) -> bool
auto loadFromFile(DefaultVertex vertex, StringView fragmentPath, std::int32_t batchSize = GLShaderProgram::DefaultBatchSize) -> bool
auto loadFromFile(const char* shaderName, Introspection introspection, StringView vertexPath, DefaultFragment fragment, std::int32_t batchSize = GLShaderProgram::DefaultBatchSize, ArrayView<const StringView> defines = {}) -> bool
auto loadFromFile(const char* shaderName, StringView vertexPath, DefaultFragment fragment, std::int32_t batchSize = GLShaderProgram::DefaultBatchSize) -> bool
auto loadFromFile(StringView vertexPath, DefaultFragment fragment, std::int32_t batchSize = GLShaderProgram::DefaultBatchSize) -> bool
auto loadFromCache(const char* shaderName, std::uint64_t shaderVersion, Introspection introspection) -> bool
auto saveToCache(const char* shaderName, std::uint64_t shaderVersion) const -> bool
auto setAttribute(const char* name, std::int32_t stride, void* pointer) -> bool
Sets the VBO stride and pointer for the specified vertex attribute.
auto isLinked() const -> bool
Returns true if the shader is linked and can therefore be used.
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 logOnErrors() const -> bool
Returns the automatic log on errors flag.
void setLogOnErrors(bool shouldLogOnErrors)
Sets the automatic log on errors flag.
void setGLShaderProgramLabel(const char* label)
Sets the OpenGL object label for the shader program.
void registerBatchedShader(Shader& batchedShader)
Registers a shaders to be used for batches of render commands.
auto getHandle() -> GLShaderProgram*

Function documentation

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

Sets the automatic log on errors flag.

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