diff --git a/modes/Tunnel.cc b/modes/Tunnel.cc index 80e9643..77accdc 100644 --- a/modes/Tunnel.cc +++ b/modes/Tunnel.cc @@ -18,6 +18,7 @@ using namespace std; #define BREAKOFF_DIST 80 #define RING_LAYER_DIST 10 #define XLATE_RATE 0.02 +#define REVOLUTION_TIME 15000 Tunnel::Tunnel() { @@ -32,7 +33,10 @@ Tunnel::~Tunnel() bool Tunnel::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; m_offset += XLATE_RATE * elapsed; @@ -44,6 +48,10 @@ bool Tunnel::expose (GnomeScreensaver & gs) glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glPushMatrix(); + glRotatef(360.0 * + ((ticks - m_start_ticks) % REVOLUTION_TIME) / REVOLUTION_TIME, + 0, 1, 0); for (list::const_iterator it = m_logos.begin(); it != m_logos.end(); it++) @@ -58,6 +66,7 @@ bool Tunnel::expose (GnomeScreensaver & gs) m_logobox.draw(); glPopMatrix(); } + glPopMatrix(); m_last_ticks = ticks; diff --git a/modes/Tunnel.h b/modes/Tunnel.h index 673b6c6..28f2092 100644 --- a/modes/Tunnel.h +++ b/modes/Tunnel.h @@ -26,6 +26,7 @@ class Tunnel : public Mode void addRing(double offset); LogoBox m_logobox; uint64_t m_last_ticks; + uint64_t m_start_ticks; std::list m_logos; double m_offset; double m_last_ring_offset;