62 lines
1.1 KiB
C++
62 lines
1.1 KiB
C++
|
|
#include <math.h>
|
|
#include <stdlib.h>
|
|
#include <sysexits.h>
|
|
#include <time.h>
|
|
#include <sys/time.h>
|
|
|
|
#include <GL/gl.h>
|
|
#include <GL/glu.h>
|
|
|
|
#include "GnomeScreensaver.h"
|
|
|
|
static bool expose (GnomeScreensaver & gs)
|
|
{
|
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
|
|
|
glPushMatrix();
|
|
glRotatef(gs.getTicks()/1000.0*360.0, 0, 0, 1);
|
|
glBegin(GL_QUADS);
|
|
glColor3f(1, 0.6, 0);
|
|
glNormal3f(0, 0, 1);
|
|
glVertex2f(1, 1);
|
|
glVertex2f(-1, 1);
|
|
glVertex2f(-1, -1);
|
|
glVertex2f(1, 0);
|
|
glEnd();
|
|
glPopMatrix();
|
|
|
|
return true;
|
|
}
|
|
|
|
static bool configure (GnomeScreensaver & gs, int width, int height)
|
|
{
|
|
glViewport(0, 0, width, height);
|
|
|
|
glMatrixMode(GL_PROJECTION);
|
|
glLoadIdentity();
|
|
gluPerspective(60.0, (double)width / (double)height, 0.001, 1000.0);
|
|
|
|
glMatrixMode(GL_MODELVIEW);
|
|
glLoadIdentity();
|
|
glTranslatef(0, 0, -2);
|
|
|
|
glShadeModel(GL_SMOOTH);
|
|
|
|
return true;
|
|
}
|
|
|
|
static bool update (GnomeScreensaver & gs)
|
|
{
|
|
return true;
|
|
}
|
|
|
|
int main (int argc, char *argv[])
|
|
{
|
|
GnomeScreensaver gs(&argc, &argv, configure, expose, update, 12);
|
|
|
|
gs.mainloop();
|
|
|
|
return 0;
|
|
}
|