From 4425ba1c0be62651bfa9769ef458c120ae864d45 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Sat, 2 Feb 2013 21:50:50 -0500 Subject: [PATCH] rotate quad based on time --- sdl_opengl_bare.d | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sdl_opengl_bare.d b/sdl_opengl_bare.d index 18d8103..566b6db 100644 --- a/sdl_opengl_bare.d +++ b/sdl_opengl_bare.d @@ -24,6 +24,8 @@ void display() { drawing = true; glClear(GL_COLOR_BUFFER_BIT); + glPushMatrix(); + glRotatef(SDL_GetTicks() * 90.0 / 1000, 0, 0, 1); glBegin(GL_QUADS); glColor3f(1, 1, 1); glVertex3f(5.0, 5.0, 0.0); @@ -34,8 +36,9 @@ void display() glColor3f(0, 1, 0); glVertex3f(5.0, -5.0, 0.0); glEnd(); - SDL_GL_SwapBuffers(); + glPopMatrix(); drawing = false; + SDL_GL_SwapBuffers(); } extern (C) Uint32 timer_callback(Uint32 interval, void *param) @@ -73,7 +76,7 @@ int main(char[][] args) init(); SDL_Event event; - SDL_AddTimer(1000 / 50, &timer_callback, null); + SDL_AddTimer(1000 / 60, &timer_callback, null); while (SDL_WaitEvent(&event)) { if (event.type == SDL_QUIT)