68 lines
1.2 KiB
C++
68 lines
1.2 KiB
C++
|
|
#include <stdlib.h>
|
|
#include <time.h>
|
|
#include <math.h>
|
|
#include <sys/types.h>
|
|
#include <unistd.h>
|
|
|
|
#include <GL/gl.h>
|
|
#include <GL/glu.h>
|
|
|
|
#include "Pedestal.h"
|
|
|
|
Pedestal::Pedestal()
|
|
{
|
|
m_last_ticks = 0;
|
|
srand(time(NULL) + getpid());
|
|
}
|
|
|
|
Pedestal::~Pedestal()
|
|
{
|
|
}
|
|
|
|
bool Pedestal::expose (GnomeScreensaver & gs)
|
|
{
|
|
if (m_last_ticks == 0)
|
|
{
|
|
m_last_ticks = gs.getTicks();
|
|
m_start_ticks = m_last_ticks;
|
|
}
|
|
uint64_t ticks = gs.getTicks();
|
|
int elapsed = ticks - m_last_ticks;
|
|
|
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
|
|
|
glPushMatrix();
|
|
glRotatef((ticks - m_start_ticks) * 0.1, 0, 0, 1);
|
|
|
|
glRotatef(90.0, 1, 0, 0);
|
|
m_logobox.draw();
|
|
|
|
glPopMatrix();
|
|
|
|
m_last_ticks = ticks;
|
|
|
|
return true;
|
|
}
|
|
|
|
bool Pedestal::configure (GnomeScreensaver & gs)
|
|
{
|
|
glMatrixMode(GL_PROJECTION);
|
|
glLoadIdentity();
|
|
gluPerspective(60.0, gs.getAspectRatio() / gs.getNumMonitors(),
|
|
0.01, 1000.0);
|
|
|
|
glMatrixMode(GL_MODELVIEW);
|
|
glLoadIdentity();
|
|
gluLookAt(0, -18, 4, 0, 0, 0, 0, 0, 1);
|
|
|
|
glViewport(0, 0, gs.getWidth(), gs.getHeight());
|
|
|
|
return true;
|
|
}
|
|
|
|
bool Pedestal::update (GnomeScreensaver & gs)
|
|
{
|
|
return true;
|
|
}
|