[Yt-svn] yt-commit r1725 - trunk/yt/extensions
mturk at wrangler.dreamhost.com
mturk at wrangler.dreamhost.com
Wed May 19 16:53:52 PDT 2010
Author: mturk
Date: Wed May 19 16:53:51 2010
New Revision: 1725
URL: http://yt.enzotools.org/changeset/1725
Log:
Fixing the stereo image display, which now *will* display stereo image pairs.
The fix is not elegant, but for now it will have to do.
Modified:
trunk/yt/extensions/opengl_image_viewer.py
Modified: trunk/yt/extensions/opengl_image_viewer.py
==============================================================================
--- trunk/yt/extensions/opengl_image_viewer.py (original)
+++ trunk/yt/extensions/opengl_image_viewer.py Wed May 19 16:53:51 2010
@@ -114,6 +114,43 @@
_display_mode = (GLUT.GLUT_RGBA | GLUT.GLUT_DOUBLE | GLUT.GLUT_DEPTH |
GLUT.GLUT_STEREO)
+ def draw(self):
+ GL.glDrawBuffer(GL.GL_BACK_LEFT)
+
+ GL.glMatrixMode(GL.GL_MODELVIEW)
+ GL.glLoadIdentity()
+
+ GL.glMatrixMode(GL.GL_PROJECTION)
+ GL.glLoadIdentity()
+
+ GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT)
+
+ if self._current >= 0:
+ self._draw_current_left()
+
+ GLUT.glutSwapBuffers()
+
+ GL.glDrawBuffer(GL.GL_BACK_RIGHT)
+
+ GL.glMatrixMode(GL.GL_MODELVIEW)
+ GL.glLoadIdentity()
+
+ GL.glMatrixMode(GL.GL_PROJECTION)
+ GL.glLoadIdentity()
+
+ GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT)
+
+ if self._current >= 0:
+ self._draw_current_right()
+
+ GLUT.glutSwapBuffers()
+
+ def _draw_current_left(self):
+ self._frames[self._current].draw_left()
+
+ def _draw_current_right(self):
+ self._frames[self._current].draw_right()
+
class FlatImage(object):
def __init__(self, tex_unit = GL.GL_TEXTURE0):
self.tex_unit = tex_unit
@@ -171,12 +208,10 @@
self.left_image = FlatImage(tex_unit)
self.right_image = FlatImage(tex_unit)
- def draw(self):
- # Look left
- GL.glDrawBuffer(GL.GL_BACK_LEFT)
+ def draw_left(self):
self.left_image.draw()
- # Look right
- GL.glDrawBuffer(GL.GL_BACK_RIGHT)
+
+ def draw_right(self):
self.right_image.draw()
def upload_images(self, buffer_left, buffer_right):
More information about the yt-svn
mailing list