[visionegg] Re: Stereo and PyOpenGL

  • From: Yuichi Sakano <yuichi@xxxxxxxxxxx>
  • To: visionegg@xxxxxxxxxxxxx
  • Date: Wed, 22 Sep 2004 18:52:55 -0400

Hi.

Thanks a lot for the information.

At first, I tried stereo on my iBook (G4, OS10.3.5) following the instruction (although I modified a little: screen argument was added in Viewport, and '1' was added as the second argument of pygame.display.gl_set_attribute), and the left and right views seem to have been presented alternately successfully!

But when I tried the similar thing on PowerMac G4 (OS10.2.8), it didn't work. Of course I followed the instruction. All the difference between the two trials was that in the second trial on PowerMac G4, all in "OpenGL.GL.__init__" were imported instead of those of "OpenGL.GL.GL__init__" because there is no "OpenGL.GL.GL__init__" on OS10.2.8 and instead, GL_STEREO is described in "OpenGL.GL.__init__". Actually, "VisionEgg Graphics Configuration" was displayed, but after that, the errors was displayed as described below:

### Error Messages ###
File "/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site- packages/VisionEgg/Core.py", line 197, in __init__
pygame.display.gl_set_attribute(pygame.locals.GL_STEREO,1)
AttributeError: 'module' object has no attribute 'GL_STEREO'


Fatal Python error: PyEval_SaveThread: NULL tstate
###################

After that, I replaced OpenGL folder in PowerMac G4 with the one in iBook, but it didn't work. Replacement of site-packages folder with HD::Library::Python::2.3 folder in iBook didn't work either. (Maybe these are not proper ways, but I was not sure how...)

If someone knows how to use stereo on Mac OS 10.2, would you let me know what's wrong?

Thanks for any help.

Yuichi



On Sep. 18 2004 at 3:38 PM, Andrew Straw wrote:

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



====================================== The Vision Egg mailing list Archives: //www.freelists.org/archives/visionegg Website: http://www.visionegg.org/mailinglist.html

Other related posts: