[visionegg] Re: Stereo and PyOpenGL
- From: Andrew Straw <astraw@xxxxxxxxxxx>
- To: visionegg@xxxxxxxxxxxxx
- Date: Sat, 18 Sep 2004 12:38:07 -0700
Dear Yuichi,
Although I've never done stereo (and the Vision Egg does not do it,
either), it looks to me like the critical commands in the demo you
reference are:
* glDrawBuffer(GL_BACK_LEFT) (and the equivalent for the right buffer)
and
* glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH | GLUT_STEREO)
The demo looks like it would straightforward to convert to a straing
PyOpenGL program.
In terms of the Vision Egg, you'd have to modify the
Core.Screen.__init__() function by inserting a
pygame.display.gl_set_attribute(pygame.locals.GL_STEREO) function call.
Then, of course, your program would have to draw the framebuffers for
both views. I suggest something like the following, which is completely
untested code I just made up, but should set you on the right track:
center = (0,0,0)
left_eye = (-1,0,-10)
right_eye = (1, 0,-10)
up = (0,1,0)
left_projection = Projection().look_at( left_eye, center, up )
right_projection = Projection().look_at( right_eye, center, up )
left_viewport =
Viewport(projection=left_projection,stimuli=your_stimuli_here)
right_viewport =
Viewport(projection=right_projection,stimuli=your_stimuli_here)
while 1:
glDrawBuffer(GL_BACK_LEFT)
screen.clear()
left_viewport.draw()
glDrawBuffer(GL_BACK_RIGHT)
screen.clear()
right_viewport.draw()
swap_buffers()
(Note this doesn't use VisionEgg.FlowControl)
Yuichi Sakano wrote:
Hi.
Is anyone using stereo (with shutter goggles) with PyOpenGL (or
VisionEgg)? I'm trying to using it, but I have no idea how to use it.
If you have succeeded in it, would you let me know how (if possible,
send the script) please?
I'm using Mac G4 (OS10.2.8, 866MHz-dual processors) and ATI RADEON
graphics board.
I can use stereo with C and OpenGL using a sample code.
http://developer.apple.com/samplecode/GLUTStereo/GLUTStereo.html
Thanks for any help.
Yuichi
======================================
The Vision Egg mailing list
Archives: //www.freelists.org/archives/visionegg
Website: http://www.visionegg.org/mailinglist.html
--
Andrew D. Straw Post-doctoral scholar
,-. Dickinson Lab
\_/ California Institute of Technology
8||} Mailcode 138-78
/ \ Pasadena CA 91125, USA
`-^
email: astraw@xxxxxxxxxxx
office: +1 626 395 5828
======================================
The Vision Egg mailing list
Archives: //www.freelists.org/archives/visionegg
Website: http://www.visionegg.org/mailinglist.html
Other related posts: