Implement Shader::UseDefault()
Some checks failed
Run ReCI Build Test / Explore-Gitea-Actions (push) Has been cancelled
Some checks failed
Run ReCI Build Test / Explore-Gitea-Actions (push) Has been cancelled
This commit is contained in:
@@ -30,6 +30,9 @@ public:
|
||||
unsigned int ID() const;
|
||||
void Use();
|
||||
|
||||
static void Use(GLuint shader_program_id);
|
||||
static void UseDefault();
|
||||
|
||||
|
||||
void Reload();
|
||||
void Unload();
|
||||
|
8
main.cpp
8
main.cpp
@@ -149,6 +149,9 @@ public:
|
||||
int blit_pos = 0;
|
||||
|
||||
void display() {
|
||||
|
||||
Shader::UseDefault();
|
||||
|
||||
pulse += 20 * delta_time;
|
||||
float dt = GetDeltaTime();
|
||||
|
||||
@@ -192,6 +195,7 @@ public:
|
||||
J3D::End();
|
||||
|
||||
J2D::Begin(j2d_render_target, true);
|
||||
|
||||
J2D::FillRect(Colors::Blue, {0,52}, {100,100});
|
||||
J2D::DrawSprite(image, {300, 400}, sprite_radians * 0.10f, {0.5,0.5}, {1, 1}, Colors::White);
|
||||
J2D::DrawMirrorSprite(image, {400, 300}, Direction::Horizontal | Direction::Vertical, sprite_radians, {0.5,0.5}, {1, 1}, Colors::White);
|
||||
@@ -228,6 +232,7 @@ public:
|
||||
b.Draw();
|
||||
c.Draw();
|
||||
d.Draw();
|
||||
|
||||
J2D::End();
|
||||
|
||||
shader.Use();
|
||||
@@ -237,6 +242,9 @@ public:
|
||||
J2D::DrawSprite(image, image_mask, {0, 0}, 0.25, {0.5, 0.5}, {1,1});
|
||||
J2D::End();
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void OnRefresh(float elapsed) override {
|
||||
|
@@ -183,4 +183,12 @@ namespace JGL {
|
||||
bool Shader::Loaded() const { return loaded;}
|
||||
|
||||
unsigned int Shader::ID() const { return id;}
|
||||
|
||||
void Shader::UseDefault() {
|
||||
glUseProgram(0);
|
||||
}
|
||||
|
||||
void Shader::Use(GLuint shader_program_id) {
|
||||
glUseProgram(shader_program_id);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user