Adding bitmap fonts
This commit is contained in:
@ -69,6 +69,11 @@ void ShaderProgram::compileShader(
|
||||
glBindAttribLocation(this->shaderProgram, 1, "aTexCoord");
|
||||
}
|
||||
|
||||
void ShaderProgram::bindAttributeLocation(std::string name, int32_t location) {
|
||||
if(this->shaderProgram == -1) throw "Shader has not yet been compiled";
|
||||
glBindAttribLocation(this->shaderProgram, location, name.c_str());
|
||||
}
|
||||
|
||||
void ShaderProgram::setTexture(shaderparameter_t param, textureslot_t slot) {
|
||||
glUniform1i(param, slot);
|
||||
}
|
||||
|
@ -25,14 +25,23 @@ namespace Dawn {
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Compiles a GLSL shader and stores it on the GPU, updates the underlying
|
||||
* pointers for you.
|
||||
* Compiles a GLSL/HLSL shader and stores it on the GPU, updates the
|
||||
* underlying pointers for you.
|
||||
*
|
||||
* @param vertexShader The string source of the vertex shader.
|
||||
* @param fragmentShader The string source of the fragment shader.
|
||||
*/
|
||||
void compileShader(std::string vertexShader, std::string fragmentShader);
|
||||
|
||||
/**
|
||||
* Typically HLSL only, this method allows you to specify where vbo
|
||||
* attributes are bound. Typically 0 for positions, 1 for coordinates,
|
||||
* etc.
|
||||
*
|
||||
* @param name Attribute name in the HLSL shader.
|
||||
* @param location Index pointing to which location it is to be bound to.
|
||||
*/
|
||||
void bindAttributeLocation(std::string name, int32_t location);
|
||||
|
||||
public:
|
||||
/**
|
||||
|
@ -83,6 +83,9 @@ namespace Dawn {
|
||||
"return o_Color;\n"
|
||||
"}\n"
|
||||
);
|
||||
|
||||
this->bindAttributeLocation("aPos", 0);
|
||||
this->bindAttributeLocation("aTexCoord", 1);
|
||||
#else
|
||||
#error Shader Type must be either GLSL or HLSL
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user