From 27e302f126a09f28847e2553d936ac7c7981683d Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Fri, 26 Nov 2010 23:02:10 -0500 Subject: [PATCH] Spin: spin a logo on each monitor --- modes/Spin.cc | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/modes/Spin.cc b/modes/Spin.cc index def37f1..f3c08cf 100644 --- a/modes/Spin.cc +++ b/modes/Spin.cc @@ -6,22 +6,27 @@ 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); - 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); - m_logobox.draw(); + glPushMatrix(); - glPopMatrix(); + glRotatef(gs.getTicks() / 1000.0 * 360.0 / 4.0, 0, 1, 0); + m_logobox.draw(); + + glPopMatrix(); + } return true; } bool Spin::configure (GnomeScreensaver & gs) { - glViewport(0, 0, gs.getWidth(), gs.getHeight()); - glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(60.0, gs.getAspectRatio(), 0.01, 1000.0);