dwss/modes/Spin.cc

48 lines
991 B
C++

#include <GL/gl.h>
#include <GL/glu.h>
#include "Spin.h"
bool Spin::expose (GnomeScreensaver & gs)
{
int n_monitors = gs.getNumMonitors();
int width = gs.getWidth() / n_monitors;
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
for (int monitor_num = 0; monitor_num < n_monitors; monitor_num++)
{
glViewport(width * monitor_num, 0, width, gs.getHeight());
glPushMatrix();
glRotatef(gs.getTicks() / 1000.0 * 360.0 / 4.0
* (monitor_num & 0x1 ? -1.0 : 1.0), 0, 1, 0);
m_logobox.draw();
glPopMatrix();
}
return true;
}
bool Spin::configure (GnomeScreensaver & gs)
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(60.0, gs.getAspectRatio() / gs.getNumMonitors(),
0.01, 1000.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0, 0, 10, 0, 0, 0, 0, 1, 0);
return true;
}
bool Spin::update (GnomeScreensaver & gs)
{
return true;
}