rotate quad based on time
This commit is contained in:
parent
3fbc5aa16d
commit
4425ba1c0b
@ -24,6 +24,8 @@ void display()
|
|||||||
{
|
{
|
||||||
drawing = true;
|
drawing = true;
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
glPushMatrix();
|
||||||
|
glRotatef(SDL_GetTicks() * 90.0 / 1000, 0, 0, 1);
|
||||||
glBegin(GL_QUADS);
|
glBegin(GL_QUADS);
|
||||||
glColor3f(1, 1, 1);
|
glColor3f(1, 1, 1);
|
||||||
glVertex3f(5.0, 5.0, 0.0);
|
glVertex3f(5.0, 5.0, 0.0);
|
||||||
@ -34,8 +36,9 @@ void display()
|
|||||||
glColor3f(0, 1, 0);
|
glColor3f(0, 1, 0);
|
||||||
glVertex3f(5.0, -5.0, 0.0);
|
glVertex3f(5.0, -5.0, 0.0);
|
||||||
glEnd();
|
glEnd();
|
||||||
SDL_GL_SwapBuffers();
|
glPopMatrix();
|
||||||
drawing = false;
|
drawing = false;
|
||||||
|
SDL_GL_SwapBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
extern (C) Uint32 timer_callback(Uint32 interval, void *param)
|
extern (C) Uint32 timer_callback(Uint32 interval, void *param)
|
||||||
@ -73,7 +76,7 @@ int main(char[][] args)
|
|||||||
|
|
||||||
init();
|
init();
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
SDL_AddTimer(1000 / 50, &timer_callback, null);
|
SDL_AddTimer(1000 / 60, &timer_callback, null);
|
||||||
while (SDL_WaitEvent(&event))
|
while (SDL_WaitEvent(&event))
|
||||||
{
|
{
|
||||||
if (event.type == SDL_QUIT)
|
if (event.type == SDL_QUIT)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user