diff --git a/u02/main.c b/u02/main.c index 1e0237e..61534a7 100644 --- a/u02/main.c +++ b/u02/main.c @@ -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;