logo change color on bounce

This commit is contained in:
Luca Conte 2024-03-25 13:00:14 +01:00
parent e0b15dc9e4
commit 489a444f8e
1 changed files with 11 additions and 7 deletions

View File

@ -9,7 +9,7 @@ GLuint program;
GLuint vao;
GLfloat hue = 0.0f;
GLfloat hueshift = 0.1f;
GLfloat hueshift = 32.7f;
GLfloat offsetX = -0.75f;
GLfloat offsetY = 0.4f;
@ -207,15 +207,19 @@ void draw(void) {
glUseProgram(program);
glBindVertexArray(vao);
hue += hueshift;
if (hue > 360) hue -= 360;
offsetX += speedX;
offsetY += speedY;
if (offsetX >= 0.75f || offsetX <= -0.75f) speedX *= -1;
if (offsetY >= 0.4f || offsetY <=-0.15f) speedY *= -1;
if (offsetX >= 0.75f || offsetX <= -0.75f) {
speedX *= -1;
hue += hueshift;
}
if (offsetY >= 0.4f || offsetY <=-0.15f) {
speedY *= -1;
hue += hueshift;
}
if (hue > 360) hue -= 360;
GLfloat r;
GLfloat g;