Fixed whatever was wrong with my shader
This commit is contained in:
@ -30,6 +30,7 @@ namespace Dawn {
|
||||
|
||||
void setDefaultParameters(Material *material) override {
|
||||
material->colorValues[this->paramColor] = COLOR_WHITE;
|
||||
material->textureValues[this->paramTexture] = nullptr;
|
||||
}
|
||||
|
||||
void setGlobalParameters(glm::mat4 proj, glm::mat4 view) override {
|
||||
@ -45,12 +46,12 @@ namespace Dawn {
|
||||
shaderparameter_t param,
|
||||
Texture *texture
|
||||
) override {
|
||||
if(texture == nullptr) {
|
||||
if(texture == nullptr || !texture->isReady()) {
|
||||
this->setBoolean(this->paramHasTexture, false);
|
||||
} else {
|
||||
this->setBoolean(this->paramHasTexture, true);
|
||||
this->setTextureSlot(param, 0x00);
|
||||
texture->bind(0x00);
|
||||
this->setTextureSlot(param, 0x01);
|
||||
texture->bind(0x01);
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,11 +74,11 @@ namespace Dawn {
|
||||
|
||||
// Fragment Shader
|
||||
"#version 330 core\n"
|
||||
"out vec4 o_Color;\n"
|
||||
"in vec2 o_TextCoord;\n"
|
||||
"out vec4 o_Color;\n"
|
||||
"uniform vec4 u_Color;\n"
|
||||
"uniform sampler2D u_Text;\n"
|
||||
"uniform bool u_HasTexture;\n"
|
||||
"uniform sampler2D u_Text;\n"
|
||||
|
||||
"void main() {\n"
|
||||
"if(u_HasTexture) {\n"
|
||||
|
@ -30,6 +30,7 @@ namespace Dawn {
|
||||
|
||||
void setDefaultParameters(Material *material) override {
|
||||
material->colorValues[this->paramColor] = COLOR_WHITE;
|
||||
material->textureValues[this->paramTexture] = nullptr;
|
||||
}
|
||||
|
||||
void setGlobalParameters(glm::mat4 proj, glm::mat4 view) override {
|
||||
@ -73,11 +74,11 @@ namespace Dawn {
|
||||
|
||||
// Fragment Shader
|
||||
"#version 330 core\n"
|
||||
"out vec4 o_Color;\n"
|
||||
"in vec2 o_TextCoord;\n"
|
||||
"out vec4 o_Color;\n"
|
||||
"uniform vec4 u_Color;\n"
|
||||
"uniform sampler2D u_Text;\n"
|
||||
"uniform bool u_HasTexture;\n"
|
||||
"uniform sampler2D u_Text;\n"
|
||||
|
||||
"void main() {\n"
|
||||
"if(u_HasTexture) {\n"
|
||||
@ -98,7 +99,6 @@ namespace Dawn {
|
||||
this->setBoolean(this->paramHasTexture, false);
|
||||
}
|
||||
|
||||
|
||||
void setUICamera(glm::mat4 view, glm::mat4 projection) {
|
||||
this->setMatrix(this->paramView, view);
|
||||
this->setMatrix(this->paramProjection, projection);
|
||||
|
Reference in New Issue
Block a user