|
From: knittl <kn...@us...> - 2009-08-03 08:40:59
|
Module: performous
Branch: master
Commit: ffc699c1a721333d75a9c94c13284871b75a548e
Author: Lasse Karkkainen <tro...@tr...>
Date: Sat Aug 1 21:07:25 2009 +0300
Kinda correct guitar rendering in multiplayer (separate perspective points). Looks weird, needs some hacking?
---
game/guitargraph.cc | 6 ++++--
game/video_driver.cc | 2 +-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index 5705dca..d7d766d 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -203,8 +203,10 @@ void GuitarGraph::draw(double time) {
engine(time);
Dimensions dimensions(1.0); // FIXME: bogus aspect ratio (is this fixable?)
dimensions.screenBottom().middle(m_cx).fixedWidth(m_width);
- glutil::PushMatrix pmb;
- glTranslatef(0.5 * (dimensions.x1() + dimensions.x2()), dimensions.y2(), 0.0f);
+ glutil::PushMatrixMode pmm(GL_PROJECTION);
+ glTranslatef((dimensions.x1() + dimensions.x2()), 0.0f, 0.0f);
+ glutil::PushMatrixMode pmb(GL_MODELVIEW);
+ glTranslatef(0.0, dimensions.y2(), 0.0f);
glRotatef(85.0f, 1.0f, 0.0f, 0.0f);
{ float s = dimensions.w() / 5.0f; glScalef(s, s, s); }
// Draw the neck
diff --git a/game/video_driver.cc b/game/video_driver.cc
index b1edfe2..431ba89 100644
--- a/game/video_driver.cc
+++ b/game/video_driver.cc
@@ -90,10 +90,10 @@ void Window::resize() {
float h = virtH();
const float near = 1.5f; // This determines FOV: the value is your distance from the monitor (the unit being the width of the Performous window)
const float far = 100.0f; // How far away can things be seen
- glFrustum(-0.5f, 0.5f, 0.5f * h, -0.5f * h, near, far);
// Set model-view matrix
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
+ glFrustum(-0.5f, 0.5f, 0.5f * h, -0.5f * h, near, far);
glTranslatef(0.0f, 0.0f, -near); // So that z = 0.0f is still on monitor surface
}
|