|
JNGL
Easy to use cross-platform 2D game library
|
Linked vertex and fragment shaders. More...
#include <jngl/ShaderProgram.hpp>
Classes | |
| struct | Context |
| Lifetime object when the ShaderProgram is in use. More... | |
Public Member Functions | |
| ShaderProgram (const Shader &vertex, const Shader &fragment) | |
| Not supported by the Direct3D 12 and Metal renderers and the Vulkan renderer on Android, which need the program's ShaderBytecode. | |
| ShaderProgram (const ShaderBytecode &) | |
| Creates the program from what jngl-shaderc has compiled it to. | |
| ShaderProgram (const ShaderProgram &)=delete | |
| ShaderProgram (ShaderProgram &&) noexcept | |
| ShaderProgram & | operator= (const ShaderProgram &)=delete |
| ShaderProgram & | operator= (ShaderProgram &&) noexcept |
| Context | use () const |
| int | getAttribLocation (const std::string &name) const |
| int | getUniformLocation (const std::string &name) const |
| Returns the location of a uniform variable for use with Context::setUniform. | |
Linked vertex and fragment shaders.
Definition at line 18 of file ShaderProgram.hpp.
|
explicit |
Creates the program from what jngl-shaderc has compiled it to.
Only supported by the Vulkan, Direct3D 12 and Metal renderers, and the bytecode has to be for the one that's compiled in.
|
nodiscard |
Returns the location of a uniform variable for use with Context::setUniform.
The returned location is stable for the lifetime of the ShaderProgram and is typically queried once (e.g. in a constructor) and then cached.
| name | name of the uniform variable as declared in the GLSL source. Note that GLSL compilers strip away uniforms that aren't actually read by the shader, so this may fail even if the variable appears in the source. |
| std::runtime_error | if no active uniform with the given name exists in the linked shader program. |