[visionegg] Re: Stereo and PyOpenGL
- From: Andrew Straw <astraw@xxxxxxxxxxx>
- To: visionegg@xxxxxxxxxxxxx
- Date: Thu, 14 Oct 2004 10:33:46 -0700
Dear Kevin,
Thanks for your work on this. I think stereo capabilities nicely
enhance the Vision Egg.
I've gone ahead and modified Core.py along similar lines to what your
files did. In addition, I've integrated a stereo option with the GUI
startup window and the VisionEgg.cfg preferences file. You can get the
changes from CVS. (Email me if you want a source tarball or zip.)
Unfortunately, none of the computers/video cards I have seems to
support stereo, so I wasn't able to test my work or to help with your
problem below. I noticed in your provided demo that you are calling
glDrawBuffer() to set whether you're drawing to the left or right
framebuffer, which seems to be the right thing to do. If we can
resolve the problems you list, I'd love to include this demo with the
Vision Egg, giving you appropriate credit, of course.
What system are you doing stereo on? If I do have access to the right
equipment, I'd be interested to try it out.
More comments/questions below:
On Oct 6, 2004, at 9:55 AM, Kevin J. MacKenzie wrote:
However, I have noticed a visual artifact that exists after modifying
the Core.Screen.__init__() function. I have attached the modified
Core.py and some sample code written by Yuichi which uses the Dots2D
stimulus class and presents a fixation square in stereo depth.
I'm not sure what you mean by "visual artifact". Can you elaborate
further?
After running this code, and then looking at another VisionEgg demo, I
notice that one of the frame buffers still has one of the left- (or
right) images from the stereo presentation.
Perhaps this is the visual artifact you refer to above? Regardless,
this is strange. Is this after the first script has ended and you've
started Python again?
Also, the addition of:
pygame.display.gl_set_attribute(pygame.locals.GL_STEREO,1)
to Core.Screen.__init__() causes all of the demos to run at 1/2 the
expected frame rate (ie. 30 fps on a 60 HZ LCD, 60 fps on a 120 HZ CRT
monitor). I am thinking that this is due to splitting the available
viewport into 2 frame buffers (for left- and right-eye presentation).
Perhaps...
Is there a way to pass an argument to Core.Screen.__init__(), which
would initialize stereo presentation when required, and to not elicit
this behaviour when it is not?
Done in the set of changes I just checked in. (I made the main changes
at the end of last week but the specific ability to use is_stereo as a
parameter to Screen.__init__() was only done this morning, so it may
not show up on the public CVS server for a couple days.)
I tried simply renaming the modified Core.py file "StereoCore.py", to
import when Stereo is required. However, this seems to have broken
some of the Core.Stimulus classes, and they no longer seem to
function.
I figure that I could simply treat each stimulus as a stereo image,
and send a left-right presentation through the viewport, however, this
seems to be more code than what would be ideal per stimulus
presentation.
I think the changes I checked in should address these issues. Let me
know if they work or if you need me to send you a copy of the files.
Also, I'm not to clear on how Python handles the video buffering, and
don't know how to clear the frame buffers after they are used and are
no longer required. If I could clear the vram after a stereo
presentation, it would at least get rid of the artifact.
I did see on an OpenGL article about stereo (
http://astronomy.swin.edu.au/~pbourke/opengl/stereogl/ ) that you can
call glDrawBuffer(GL_BACK) before calling glClear(...). Since the
Vision Egg does the glClear() work, I suggest calling
glDrawBuffer(GL_BACK) when you're done drawing the individual buffers.
Please let us know how you go on this!
Cheers!
Andrew
======================================
The Vision Egg mailing list
Archives: //www.freelists.org/archives/visionegg
Website: http://www.visionegg.org/mailinglist.html
Other related posts: