X-Git-Url: http://git.lukelau.me/?p=opengl.git;a=blobdiff_plain;f=main.cpp;h=99312d384ed00ea36ff83640f32d5621201704fd;hp=503f469bba97524bf92b10a64164a8d4bdbed39d;hb=150ba29f1ce70777762cb7fc44e00e52339bb66e;hpb=5fa27af6222eab1f43e6ca01f1c37cbfa1d86fcd diff --git a/main.cpp b/main.cpp index 503f469..99312d3 100644 --- a/main.cpp +++ b/main.cpp @@ -42,9 +42,9 @@ void display() { glUniformMatrix4fv(viewId, 1, GL_FALSE, glm::value_ptr(view)); GLuint modelId = glGetUniformLocation(progId, "model"); - float d = (float)glutGet(GLUT_ELAPSED_TIME) * 0.001f; glm::mat4 model = glm::mat4(1.f); + float d = (float)glutGet(GLUT_ELAPSED_TIME) * 0.001f; model = glm::translate(model, glm::vec3(sin(i * 30) * 10, cos(i * 30) * 10, i * 2)); if (doRotate) { @@ -223,7 +223,7 @@ void keyboardUp(unsigned char key, int x, int y) { keyStates[key] = false; } -void idle(int _) { +void timer(int _) { float xSpeed = 0.f, ySpeed = 0.f, zSpeed = 0.f; if (keyStates['w']) zSpeed = 0.1f; @@ -288,7 +288,7 @@ int main(int argc, char** argv) { glutKeyboardFunc(keyboard); glutKeyboardUpFunc(keyboardUp); - glutTimerFunc(16, idle, 0); + glutTimerFunc(16, timer, 0); glutMotionFunc(motion); glutMouseFunc(mouse);