Spin: spin a logo on each monitor

This commit is contained in:
Josh Holtrop 2010-11-26 23:02:10 -05:00
parent 15dc4f8d75
commit 27e302f126

View File

@ -6,22 +6,27 @@
bool Spin::expose (GnomeScreensaver & gs) 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); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix(); for (int i = 0; i < n_monitors; i++)
{
glViewport(width * i, 0, width, gs.getHeight());
glRotatef(gs.getTicks() / 1000.0 * 360.0 / 4.0, 0, 1, 0); glPushMatrix();
m_logobox.draw();
glPopMatrix(); glRotatef(gs.getTicks() / 1000.0 * 360.0 / 4.0, 0, 1, 0);
m_logobox.draw();
glPopMatrix();
}
return true; return true;
} }
bool Spin::configure (GnomeScreensaver & gs) bool Spin::configure (GnomeScreensaver & gs)
{ {
glViewport(0, 0, gs.getWidth(), gs.getHeight());
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);
glLoadIdentity(); glLoadIdentity();
gluPerspective(60.0, gs.getAspectRatio(), 0.01, 1000.0); gluPerspective(60.0, gs.getAspectRatio(), 0.01, 1000.0);