# HG changeset patch # User Thibaut Girka # Date 1312377926 -7200 # Node ID 548662d708603f9331cd43349ad8793e929dfc5a # Parent 059ea0ea8d3844d16c29f54235c010d573587e66 Add some explanations to the magic constants diff --git a/stageviewer.py b/stageviewer.py --- a/stageviewer.py +++ b/stageviewer.py @@ -262,6 +262,11 @@ def main(path, stage_num): glMatrixMode(GL_MODELVIEW) glLoadIdentity() + # Some explanations on the magic constants: + # 192. = 384. / 2. = width / 2. + # 224. = 448. / 2. = height / 2. + # 835.979370 = 224./math.tan(math.radians(15)) = (height/2.)/math.tan(math.radians(fov/2)) + # This is so that objects on the (O, x, y) plane use pixel coordinates gluLookAt(192., 224., - 835.979370 * dz, 192., 224. - dy, 750 - 835.979370 * dz, 0., -1., 0.) #TODO: 750 might not be accurate #print(glGetFloat(GL_MODELVIEW_MATRIX)) @@ -269,6 +274,11 @@ def main(path, stage_num): glDrawArrays(GL_QUADS, 0, nb_vertices) + #TODO: show the game itself + # It is displayed on (0, 0, 0), (0, 448, 0), (388, 448, 0), (388, 0, 0) + # using a camera at (192, 224, -835.979370) looking right behind itself + # Depth test should be disabled when rendering the game + pygame.display.flip() clock.tick(120) frame += 1