[visionegg] Sorry, wrong attachment

I apologize for double posting. I attached the example with an incorrect line.

The last file used a renamed Core.py module called StereoCore.py, which causes an exception. I have reattached the example code, importing the modified Core.py module.

Thank you,

Kevin


"""Sticking out FixPoint (stereo) & Random dots."""

# The first Stereo program that can be seen stereoscopically!!!
# The stimulus disappears after any key-pressing.

# written by Yuichi Sakano (2004.9.30)

import VisionEgg
VisionEgg.start_default_logging(); VisionEgg.watch_exceptions()

from VisionEgg.Core import *
import pygame
from pygame.locals import *
from VisionEgg.Text import *
from VisionEgg.Dots import *
from OpenGL.GL.GL__init__ import *

screen = get_default_screen()
screen.parameters.bgcolor = (0.0,0.0,0.0) # black (RGB)
# the simple dots2d script.  need to get this for display of a cylinder
dots = DotArea2D( position                = ( screen.size[0]/2.0, 
screen.size[1]/2.0 ),
                  size                    = ( 300.0 , 300.0 ),
                  signal_fraction         = 0.1,
                  signal_direction_deg    = 180.0,
                  velocity_pixels_per_sec = 10.0,
                  dot_lifespan_sec        = 5.0,
                  dot_size                = 3.0,
                  num_dots                = 300)

# this is where the disparity is introduced (I am assuming).  Fixation spot 
'pop' out.
fixation_spotR = FixationSpot(position=(screen.size[0]/2-10,screen.size[1]/2),
                                                         anchor='center',
                                                         color=(255,0,0,0),
                                                         size=(14,14))
fixation_spotL = FixationSpot(position=(screen.size[0]/2+10,screen.size[1]/2),
                                                         anchor='center',
                                                         color=(255,0,0,0),
                                                         size=(14,14))

blue_lineR = FixationSpot(position=(0,0),# (x,y)(lowerleft:(0,0))
                                                         anchor='lowerleft',
                                                         color=(0,0,255,0),
                                                         
size=(screen.size[0]*0.80, 0.5))
blue_lineL = FixationSpot(position=(0,0),
                                                         anchor='lowerleft',
                                                         color=(0,0,255,0),
                                                         
size=(screen.size[0]*0.30, 0.5))

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(screen=screen,
                                projection=left_projection,
                                stimuli=[dots, fixation_spotL, blue_lineL])
right_viewport = Viewport(screen=screen,
                                projection=right_projection,
                                stimuli=[dots, fixation_spotR, blue_lineR])


### For goggle synchronizing ###

glPushAttrib(GL_ALL_ATTRIB_BITS)

glDisable(GL_ALPHA_TEST)
glDisable(GL_BLEND)

for i in range(6):
    glDisable(GL_CLIP_PLANE0+i)

glDisable(GL_COLOR_LOGIC_OP)
glDisable(GL_COLOR_MATERIAL)
glDisable(GL_DEPTH_TEST)
glDisable(GL_DITHER)
glDisable(GL_FOG)
glDisable(GL_LIGHTING)
glDisable(GL_LINE_SMOOTH)
glDisable(GL_LINE_STIPPLE)
glDisable(GL_SCISSOR_TEST)
#glDisable(GL_SHARED_TEXTURE_PALETTE_EXT)#This arg is not defined.
glDisable(GL_STENCIL_TEST)
glDisable(GL_TEXTURE_1D)
glDisable(GL_TEXTURE_2D)
#glDisable(GL_TEXTURE_3D)#This arg is not defined.
#glDisable(GL_TEXTURE_CUBE_MAP)#This arg is not defined.
#glDisable(GL_TEXTURE_RECTANGLE_EXT)#This arg is not defined.
#glDisable(GL_VERTEX_PROGRAM_ARB)#This arg is not defined.

######################

frame_timer = FrameTimer()
quit_now = 0
while not quit_now:
    for event in pygame.event.get():
        if event.type in (QUIT,KEYDOWN,MOUSEBUTTONDOWN):
            quit_now = 1

    Buffers = [GL_BACK_LEFT, GL_BACK_RIGHT]
    for buffer in Buffers:
        glDrawBuffer(buffer)

        glColor3d(0.0, 0.0, 0.0)
        glBegin(GL_LINES)# Draw a background line
        glVertex3f(0.0, screen.size[1] - 0.5, 0.0)
        glVertex3f(screen.size[0], screen.size[1] - 0.5, 0.0)
        glEnd()
        glColor3d(0.0, 0.0, 1.0)
        glBegin(GL_LINES)# Draw a line of the correct length 
        glVertex3f(0.0, screen.size[1] - 0.5, 0.0)
        if buffer == GL_BACK_LEFT:
            glVertex3f(screen.size[0] * 0.30, screen.size[1] - 0.5, 0.0)#Left
        else:
            glVertex3f(screen.size[0] * 0.80, screen.size[1] - 0.5, 0.0)#Right
        glEnd()

        screen.clear()
        if buffer == GL_BACK_LEFT:
            left_viewport.draw()
        else:
            right_viewport.draw()

    swap_buffers()
    frame_timer.tick()
frame_timer.log_histogram()
screen.clear()

Other related posts: