Example #1
0
 def _draw(self):
     p = self.parameters
     center = VisionEgg._get_center(p.position, p.anchor,
                                    (p.radius, p.radius))
     gl.glDisable(gl.GL_DEPTH_TEST)
     gl.glDisable(gl.GL_TEXTURE_2D)
     gl.glDisable(gl.GL_BLEND)
     gl.glColor(p.color)
     start, end = p.start, p.end
     if end < start:
         start -= 360.
     start, end = map(numpy.deg2rad, (start, end))
     frac = (end - start) / (2 * numpy.pi)
     num_triangles = float(p.num_triangles) * frac
     angles = numpy.linspace(start, end, num_triangles)
     verts = numpy.zeros((num_triangles, 2))
     verts[:, 0] = center[0] + p.radius * numpy.cos(angles)
     verts[:, 1] = center[1] + p.radius * numpy.sin(angles)
     if p.disk:
         gl.glBegin(gl.GL_TRIANGLE_FAN)
         gl.glVertex(center)
         self._draw_vertices(*verts)
         gl.glEnd()
         if p.anti_aliasing:
             gl.glEnable(gl.GL_LINE_SMOOTH)
             gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA)
             gl.glEnable(gl.GL_BLEND)
             # Draw a second polygon in line mode, so the edges are anti-aliased
             gl.glPolygonMode(gl.GL_FRONT_AND_BACK, gl.GL_LINE)
             gl.glBegin(gl.GL_TRIANGLE_FAN)
             gl.glVertex(center)
             self._draw_vertices(*verts)
             gl.glEnd()
             gl.glPolygonMode(gl.GL_FRONT_AND_BACK, gl.GL_FILL)
             gl.glDisable(gl.GL_LINE_SMOOTH)
     if p.circle:
         if p.anti_aliasing:
             gl.glEnable(gl.GL_LINE_SMOOTH)
         gl.glColor(p.color_edge)
         gl.glLineWidth(p.circle_width)
         gl.glBegin(gl.GL_LINES)
         for i in range(verts.shape[0] - 1):
             self._draw_vertices(verts[i], verts[i + 1])
         gl.glEnd()
         gl.glDisable(gl.GL_LINE_SMOOTH)
Example #2
0
 def _draw(self):
     p = self.parameters
     center = VisionEgg._get_center(p.position, p.anchor, (p.radius, p.radius))
     gl.glDisable(gl.GL_DEPTH_TEST)
     gl.glDisable(gl.GL_TEXTURE_2D)
     gl.glDisable(gl.GL_BLEND)
     gl.glColor(p.color)
     start, end = p.start, p.end
     if end < start:
         start -= 360.
     start, end = map(numpy.deg2rad, (start, end))
     frac = (end - start) / (2 * numpy.pi)
     num_triangles = float(p.num_triangles) * frac
     angles = numpy.linspace(start, end, num_triangles)
     verts = numpy.zeros((num_triangles, 2))
     verts[:,0] = center[0] + p.radius * numpy.cos(angles)
     verts[:,1] = center[1] + p.radius * numpy.sin(angles)
     if p.disk:
         gl.glBegin(gl.GL_TRIANGLE_FAN)
         gl.glVertex(center)
         self._draw_vertices(*verts)
         gl.glEnd()
         if p.anti_aliasing:
             gl.glEnable(gl.GL_LINE_SMOOTH)
             gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA)
             gl.glEnable(gl.GL_BLEND)
             # Draw a second polygon in line mode, so the edges are anti-aliased
             gl.glPolygonMode(gl.GL_FRONT_AND_BACK, gl.GL_LINE)
             gl.glBegin(gl.GL_TRIANGLE_FAN)
             gl.glVertex(center)
             self._draw_vertices(*verts)
             gl.glEnd()
             gl.glPolygonMode(gl.GL_FRONT_AND_BACK, gl.GL_FILL)
             gl.glDisable(gl.GL_LINE_SMOOTH)
     if p.circle:
         if p.anti_aliasing:
             gl.glEnable(gl.GL_LINE_SMOOTH)
         gl.glColor(p.color_edge)
         gl.glLineWidth(p.circle_width)
         gl.glBegin(gl.GL_LINES)
         for i in range(verts.shape[0]-1):
             self._draw_vertices(verts[i], verts[i+1])
         gl.glEnd()
         gl.glDisable(gl.GL_LINE_SMOOTH)
Example #3
0
    def draw(self):
        p = self.parameters # shorthand
        if p.center is not None:
            if not hasattr(VisionEgg.config,"_GAVE_CENTER_DEPRECATION"):
                logger = logging.getLogger('VisionEgg.MoreStimuli')
                logger.warning("Specifying Target2D by deprecated "
                               "'center' parameter deprecated.  Use "
                               "'position' parameter instead.  (Allows "
                               "use of 'anchor' parameter to set to "
                               "other values.)")
                VisionEgg.config._GAVE_CENTER_DEPRECATION = 1
            p.anchor = 'center'
            p.position = p.center[0], p.center[1] # copy values (don't copy ref to tuple)
        if p.on:
            # calculate center
            center = VisionEgg._get_center(p.position,p.anchor,p.size)
            gl.glMatrixMode(gl.GL_MODELVIEW)
            gl.glPushMatrix()
            gl.glTranslate(center[0],center[1],0.0)
            gl.glRotate(p.orientation,0.0,0.0,1.0)

            if len(p.color)==3:
                gl.glColor3f(*p.color)
            elif len(p.color)==4:
                gl.glColor4f(*p.color)
            gl.glDisable(gl.GL_DEPTH_TEST)
            gl.glDisable(gl.GL_TEXTURE_2D)
            gl.glBlendFunc(gl.GL_SRC_ALPHA,gl.GL_ONE_MINUS_SRC_ALPHA)
            gl.glEnable(gl.GL_BLEND)

            w = p.size[0]/2.0
            h = p.size[1]/2.0

            gl.glBegin(gl.GL_QUADS)
            gl.glVertex3f(-w,-h, 0.0)
            gl.glVertex3f( w,-h, 0.0)
            gl.glVertex3f( w, h, 0.0)
            gl.glVertex3f(-w, h, 0.0)
            gl.glEnd() # GL_QUADS

            if p.anti_aliasing:
                if not self._gave_alpha_warning:
                    if len(p.color) > 3 and p.color[3] != 1.0:
                        logger = logging.getLogger('VisionEgg.MoreStimuli')
                        logger.warning("The parameter anti_aliasing is "
                                       "set to true in the Target2D "
                                       "stimulus class, but the color "
                                       "parameter specifies an alpha "
                                       "value other than 1.0.  To "
                                       "acheive anti-aliasing, ensure "
                                       "that the alpha value for the "
                                       "color parameter is 1.0.")
                        self._gave_alpha_warning = 1

                # We've already drawn a filled polygon (aliased), now
                # redraw the outline of the polygon (with
                # anti-aliasing).  (Using GL_POLYGON_SMOOTH results in
                # artifactual lines where triangles were joined to
                # create quad, at least on some OpenGL
                # implementations.)

                # Calculate coverage value for each pixel of outline
                # and store as alpha
                gl.glEnable(gl.GL_LINE_SMOOTH)
                # Now specify how to use the alpha value
                gl.glBlendFunc(gl.GL_SRC_ALPHA,gl.GL_ONE_MINUS_SRC_ALPHA)
                gl.glEnable(gl.GL_BLEND)

                # Draw a second polygon in line mode, so the edges are anti-aliased
                gl.glPolygonMode(gl.GL_FRONT_AND_BACK,gl.GL_LINE)
                gl.glBegin(gl.GL_QUADS)
                gl.glVertex3f(-w,-h, 0.0);
                gl.glVertex3f( w,-h, 0.0);
                gl.glVertex3f( w, h, 0.0);
                gl.glVertex3f(-w, h, 0.0);
                gl.glEnd() # GL_QUADS

                # Set the polygon mode back to fill mode
                gl.glPolygonMode(gl.GL_FRONT_AND_BACK,gl.GL_FILL)
                gl.glDisable(gl.GL_LINE_SMOOTH)
            gl.glPopMatrix()
Example #4
0
    def draw(self):
        p = self.parameters # shorthand
        if p.on:
            # calculate center
            center = VisionEgg._get_center(p.position,p.anchor,(p.radius, p.radius))
            gl.glDisable(gl.GL_DEPTH_TEST)
            gl.glDisable(gl.GL_TEXTURE_2D)
            gl.glDisable(gl.GL_BLEND)

            if len(p.color)==3:
                gl.glColor3f(*p.color)
            elif len(p.color)==4:
                gl.glColor4f(*p.color)

          # Build filled circle from points
#           gl.glBegin(gl.GL_POINTS)
#           radius = int(math.ceil(p.radius))
#           for i in range(-radius, radius):
#               for j in range(-radius, radius):
#                   if(i * i + j * j < radius * radius):
#                       gl.glVertex3f(p.position[0] + i, p.position[1] + j, 0.0)
#           gl.glEnd() # GL_POINTS

            # Build filled circle from triangles (this is typically faster
            # then the commented code above with the points)
            gl.glBegin(gl.GL_TRIANGLE_FAN)
            gl.glVertex3f(p.position[0], p.position[1], 0.0)
            angles = Numeric.arange(p.num_triangles)/float(p.num_triangles)*2.0*math.pi
            verts = Numeric.zeros( (p.num_triangles,2), Numeric.Float )
            verts[:,0] = p.position[0] + p.radius * Numeric.cos(angles)
            verts[:,1] = p.position[1] + p.radius * Numeric.sin(angles)
            for i in range(verts.shape[0]):
                gl.glVertex2fv(verts[i])
            gl.glVertex2fv(verts[0])

            gl.glEnd() # GL_TRIANGLE_FAN
            if p.anti_aliasing:
                if not self._gave_alpha_warning:
                    if len(p.color) > 3 and p.color[3] != 1.0:
                        logger = logging.getLogger('VisionEgg.Arrow')
                        logger.warning("The parameter anti_aliasing is "
                                       "set to true in the Arrow "
                                       "stimulus class, but the color "
                                       "parameter specifies an alpha "
                                       "value other than 1.0.  To "
                                       "acheive anti-aliasing, ensure "
                                       "that the alpha value for the "
                                       "color parameter is 1.0.")
                        self._gave_alpha_warning = 1

                        # We've already drawn a filled polygon (aliased), now redraw
                        # the outline of the polygon (with anti-aliasing). (Using
                        # GL_POLYGON_SMOOTH results in artifactual lines where
                        # triangles were joined to create quad, at least on some OpenGL
                        # implementations.)

                # Calculate coverage value for each pixel of outline
                # and store as alpha
                gl.glEnable(gl.GL_LINE_SMOOTH)
                # Now specify how to use the alpha value
                gl.glBlendFunc(gl.GL_SRC_ALPHA,gl.GL_ONE_MINUS_SRC_ALPHA)
                gl.glEnable(gl.GL_BLEND)

                # Draw a second polygon in line mode, so the edges are anti-aliased
                gl.glPolygonMode(gl.GL_FRONT_AND_BACK,gl.GL_LINE)
                gl.glBegin(gl.GL_TRIANGLE_FAN)
                gl.glVertex3f(p.position[0], p.position[1], 0.0)
                angles = Numeric.arange(p.num_triangles)/float(p.num_triangles)*2.0*math.pi
                verts = Numeric.zeros( (p.num_triangles,2), Numeric.Float )
                verts[:,0] = p.position[0] + p.radius * Numeric.cos(angles)
                verts[:,1] = p.position[1] + p.radius * Numeric.sin(angles)
                for i in range(verts.shape[0]):
                    gl.glVertex2fv(verts[i])
                gl.glVertex2fv(verts[0])
                gl.glEnd() # GL_TRIANGLE_FAN

                # Set the polygon mode back to fill mode
                gl.glPolygonMode(gl.GL_FRONT_AND_BACK,gl.GL_FILL)
                gl.glDisable(gl.GL_LINE_SMOOTH)
Example #5
0
    def draw(self):
        p = self.parameters # Shorthand
        if p.on:
            # Calculate center
            center = VisionEgg._get_center(p.position,p.anchor,p.size)
            gl.glMatrixMode(gl.GL_MODELVIEW)
            gl.glPushMatrix()
            gl.glTranslate(center[0],center[1],0.0)
            gl.glRotate(-p.orientation,0.0,0.0,1.0)

            if len(p.color)==3:
                gl.glColor3f(*p.color)
            elif len(p.color)==4:
                gl.glColor4f(*p.color)
            gl.glDisable(gl.GL_DEPTH_TEST)
            gl.glDisable(gl.GL_TEXTURE_2D)
            gl.glBlendFunc(gl.GL_SRC_ALPHA,gl.GL_ONE_MINUS_SRC_ALPHA)
            gl.glEnable(gl.GL_BLEND)

            w = p.size[0]/2.0
            h = p.size[1]/2.0

            gl.glBegin(gl.GL_QUADS) # Draw Rectangle
            gl.glVertex3f( 0.25*w, h, 0.0)
            gl.glVertex3f(-w, h, 0.0)
            gl.glVertex3f(-w,-h, 0.0)
            gl.glVertex3f( 0.25*w, -h, 0.0)
            gl.glEnd() # GL_QUADS

            gl.glBegin(gl.GL_TRIANGLES) # Draw Triangle
            gl.glVertex3f( 1.00*w, 0.0*h, 0.0) # Top
            gl.glVertex3f( 0.25*w,-3.0*h, 0.0)
            gl.glVertex3f( 0.25*w, 3.0*h, 0.0)
            gl.glEnd() # GL_QUADS

            if p.anti_aliasing:
                if not self._gave_alpha_warning:
                    if len(p.color) > 3 and p.color[3] != 1.0:
                        logger = logging.getLogger('VisionEgg.Arrow')
                        logger.warning("The parameter anti_aliasing is "
                                       "set to true in the Arrow "
                                       "stimulus class, but the color "
                                       "parameter specifies an alpha "
                                       "value other than 1.0.  To "
                                       "acheive anti-aliasing, ensure "
                                       "that the alpha value for the "
                                       "color parameter is 1.0.")
                        self._gave_alpha_warning = 1

                # We've already drawn a filled polygon (aliased), now redraw
                # the outline of the polygon (with anti-aliasing). (Using
                # GL_POLYGON_SMOOTH results in artifactual lines where
                # triangles were joined to create quad, at least on some OpenGL
                # implementations.)

                # Calculate coverage value for each pixel of outline
                # and store as alpha
                gl.glEnable(gl.GL_LINE_SMOOTH)
                # Now specify how to use the alpha value
                gl.glBlendFunc(gl.GL_SRC_ALPHA,gl.GL_ONE_MINUS_SRC_ALPHA)
                gl.glEnable(gl.GL_BLEND)

                # Draw a second polygon in line mode, so the edges are anti-aliased
                gl.glPolygonMode(gl.GL_FRONT_AND_BACK,gl.GL_LINE)
                gl.glBegin(gl.GL_QUADS)

                gl.glVertex3f( 0.25*w, h, 0.0) # Draw Rectangle
                gl.glVertex3f(-w, h, 0.0)
                gl.glVertex3f(-w,-h, 0.0)
                gl.glVertex3f( 0.25*w, -h, 0.0)
                gl.glVertex3f( 1.00*w, 0.0*h, 0.0) # Draw Triangle
                gl.glVertex3f( 0.25*w,-3.0*h, 0.0)
                gl.glVertex3f( 0.25*w, 3.0*h, 0.0)
                gl.glEnd() # GL_QUADS

                # Set the polygon mode back to fill mode
                gl.glPolygonMode(gl.GL_FRONT_AND_BACK,gl.GL_FILL)
                gl.glDisable(gl.GL_LINE_SMOOTH)
            gl.glPopMatrix()
Example #6
0
    def draw(self):
        p = self.parameters  # shorthand
        if p.center is not None:
            if not hasattr(VisionEgg.config, "_GAVE_CENTER_DEPRECATION"):
                logger = logging.getLogger('VisionEgg.MoreStimuli')
                logger.warning("Specifying Target2D by deprecated "
                               "'center' parameter deprecated.  Use "
                               "'position' parameter instead.  (Allows "
                               "use of 'anchor' parameter to set to "
                               "other values.)")
                VisionEgg.config._GAVE_CENTER_DEPRECATION = 1
            p.anchor = 'center'
            p.position = p.center[0], p.center[
                1]  # copy values (don't copy ref to tuple)
        if p.on:
            # calculate center
            center = VisionEgg._get_center(p.position, p.anchor, p.size)
            gl.glMatrixMode(gl.GL_MODELVIEW)
            gl.glPushMatrix()
            gl.glTranslate(center[0], center[1], 0.0)
            gl.glRotate(p.orientation, 0.0, 0.0, 1.0)

            if len(p.color) == 3:
                gl.glColor3f(*p.color)
            elif len(p.color) == 4:
                gl.glColor4f(*p.color)
            gl.glDisable(gl.GL_DEPTH_TEST)
            gl.glDisable(gl.GL_TEXTURE_2D)
            gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA)
            gl.glEnable(gl.GL_BLEND)

            w = p.size[0] / 2.0
            h = p.size[1] / 2.0

            gl.glBegin(gl.GL_QUADS)
            gl.glVertex3f(-w, -h, 0.0)
            gl.glVertex3f(w, -h, 0.0)
            gl.glVertex3f(w, h, 0.0)
            gl.glVertex3f(-w, h, 0.0)
            gl.glEnd()  # GL_QUADS

            if p.anti_aliasing:
                if not self._gave_alpha_warning:
                    if len(p.color) > 3 and p.color[3] != 1.0:
                        logger = logging.getLogger('VisionEgg.MoreStimuli')
                        logger.warning("The parameter anti_aliasing is "
                                       "set to true in the Target2D "
                                       "stimulus class, but the color "
                                       "parameter specifies an alpha "
                                       "value other than 1.0.  To "
                                       "acheive anti-aliasing, ensure "
                                       "that the alpha value for the "
                                       "color parameter is 1.0.")
                        self._gave_alpha_warning = 1

                # We've already drawn a filled polygon (aliased), now
                # redraw the outline of the polygon (with
                # anti-aliasing).  (Using GL_POLYGON_SMOOTH results in
                # artifactual lines where triangles were joined to
                # create quad, at least on some OpenGL
                # implementations.)

                # Calculate coverage value for each pixel of outline
                # and store as alpha
                gl.glEnable(gl.GL_LINE_SMOOTH)
                # Now specify how to use the alpha value
                gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA)
                gl.glEnable(gl.GL_BLEND)

                # Draw a second polygon in line mode, so the edges are anti-aliased
                gl.glPolygonMode(gl.GL_FRONT_AND_BACK, gl.GL_LINE)
                gl.glBegin(gl.GL_QUADS)
                gl.glVertex3f(-w, -h, 0.0)
                gl.glVertex3f(w, -h, 0.0)
                gl.glVertex3f(w, h, 0.0)
                gl.glVertex3f(-w, h, 0.0)
                gl.glEnd()  # GL_QUADS

                # Set the polygon mode back to fill mode
                gl.glPolygonMode(gl.GL_FRONT_AND_BACK, gl.GL_FILL)
                gl.glDisable(gl.GL_LINE_SMOOTH)
            gl.glPopMatrix()
Example #7
0
    def draw(self):
        p = self.parameters  # shorthand
        if p.on:
            # calculate center
            center = VisionEgg._get_center(p.position, p.anchor,
                                           (p.radius, p.radius))
            gl.glDisable(gl.GL_DEPTH_TEST)
            gl.glDisable(gl.GL_TEXTURE_2D)
            gl.glDisable(gl.GL_BLEND)

            if len(p.color) == 3:
                gl.glColor3f(*p.color)
            elif len(p.color) == 4:
                gl.glColor4f(*p.color)

        # Build filled circle from points
#           gl.glBegin(gl.GL_POINTS)
#           radius = int(math.ceil(p.radius))
#           for i in range(-radius, radius):
#               for j in range(-radius, radius):
#                   if(i * i + j * j < radius * radius):
#                       gl.glVertex3f(p.position[0] + i, p.position[1] + j, 0.0)
#           gl.glEnd() # GL_POINTS

# Build filled circle from triangles (this is typically faster
# then the commented code above with the points)
            gl.glBegin(gl.GL_TRIANGLE_FAN)
            gl.glVertex3f(p.position[0], p.position[1], 0.0)
            angles = Numeric.arange(p.num_triangles) / float(
                p.num_triangles) * 2.0 * math.pi
            verts = Numeric.zeros((p.num_triangles, 2), Numeric.Float)
            verts[:, 0] = p.position[0] + p.radius * Numeric.cos(angles)
            verts[:, 1] = p.position[1] + p.radius * Numeric.sin(angles)
            for i in range(verts.shape[0]):
                gl.glVertex2fv(verts[i])
            gl.glVertex2fv(verts[0])

            gl.glEnd()  # GL_TRIANGLE_FAN
            if p.anti_aliasing:
                if not self._gave_alpha_warning:
                    if len(p.color) > 3 and p.color[3] != 1.0:
                        logger = logging.getLogger('VisionEgg.Arrow')
                        logger.warning("The parameter anti_aliasing is "
                                       "set to true in the Arrow "
                                       "stimulus class, but the color "
                                       "parameter specifies an alpha "
                                       "value other than 1.0.  To "
                                       "acheive anti-aliasing, ensure "
                                       "that the alpha value for the "
                                       "color parameter is 1.0.")
                        self._gave_alpha_warning = 1

                        # We've already drawn a filled polygon (aliased), now redraw
                        # the outline of the polygon (with anti-aliasing). (Using
                        # GL_POLYGON_SMOOTH results in artifactual lines where
                        # triangles were joined to create quad, at least on some OpenGL
                        # implementations.)

                # Calculate coverage value for each pixel of outline
                # and store as alpha
                gl.glEnable(gl.GL_LINE_SMOOTH)
                # Now specify how to use the alpha value
                gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA)
                gl.glEnable(gl.GL_BLEND)

                # Draw a second polygon in line mode, so the edges are anti-aliased
                gl.glPolygonMode(gl.GL_FRONT_AND_BACK, gl.GL_LINE)
                gl.glBegin(gl.GL_TRIANGLE_FAN)
                gl.glVertex3f(p.position[0], p.position[1], 0.0)
                angles = Numeric.arange(p.num_triangles) / float(
                    p.num_triangles) * 2.0 * math.pi
                verts = Numeric.zeros((p.num_triangles, 2), Numeric.Float)
                verts[:, 0] = p.position[0] + p.radius * Numeric.cos(angles)
                verts[:, 1] = p.position[1] + p.radius * Numeric.sin(angles)
                for i in range(verts.shape[0]):
                    gl.glVertex2fv(verts[i])
                gl.glVertex2fv(verts[0])
                gl.glEnd()  # GL_TRIANGLE_FAN

                # Set the polygon mode back to fill mode
                gl.glPolygonMode(gl.GL_FRONT_AND_BACK, gl.GL_FILL)
                gl.glDisable(gl.GL_LINE_SMOOTH)
Example #8
0
    def draw(self):
        p = self.parameters  # Shorthand
        if p.on:
            # Calculate center
            center = VisionEgg._get_center(p.position, p.anchor, p.size)
            gl.glMatrixMode(gl.GL_MODELVIEW)
            gl.glPushMatrix()
            gl.glTranslate(center[0], center[1], 0.0)
            gl.glRotate(-p.orientation, 0.0, 0.0, 1.0)

            if len(p.color) == 3:
                gl.glColor3f(*p.color)
            elif len(p.color) == 4:
                gl.glColor4f(*p.color)
            gl.glDisable(gl.GL_DEPTH_TEST)
            gl.glDisable(gl.GL_TEXTURE_2D)
            gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA)
            gl.glEnable(gl.GL_BLEND)

            w = p.size[0] / 2.0
            h = p.size[1] / 2.0

            gl.glBegin(gl.GL_QUADS)  # Draw Rectangle
            gl.glVertex3f(0.25 * w, h, 0.0)
            gl.glVertex3f(-w, h, 0.0)
            gl.glVertex3f(-w, -h, 0.0)
            gl.glVertex3f(0.25 * w, -h, 0.0)
            gl.glEnd()  # GL_QUADS

            gl.glBegin(gl.GL_TRIANGLES)  # Draw Triangle
            gl.glVertex3f(1.00 * w, 0.0 * h, 0.0)  # Top
            gl.glVertex3f(0.25 * w, -3.0 * h, 0.0)
            gl.glVertex3f(0.25 * w, 3.0 * h, 0.0)
            gl.glEnd()  # GL_QUADS

            if p.anti_aliasing:
                if not self._gave_alpha_warning:
                    if len(p.color) > 3 and p.color[3] != 1.0:
                        logger = logging.getLogger('VisionEgg.Arrow')
                        logger.warning("The parameter anti_aliasing is "
                                       "set to true in the Arrow "
                                       "stimulus class, but the color "
                                       "parameter specifies an alpha "
                                       "value other than 1.0.  To "
                                       "acheive anti-aliasing, ensure "
                                       "that the alpha value for the "
                                       "color parameter is 1.0.")
                        self._gave_alpha_warning = 1

                # We've already drawn a filled polygon (aliased), now redraw
                # the outline of the polygon (with anti-aliasing). (Using
                # GL_POLYGON_SMOOTH results in artifactual lines where
                # triangles were joined to create quad, at least on some OpenGL
                # implementations.)

                # Calculate coverage value for each pixel of outline
                # and store as alpha
                gl.glEnable(gl.GL_LINE_SMOOTH)
                # Now specify how to use the alpha value
                gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA)
                gl.glEnable(gl.GL_BLEND)

                # Draw a second polygon in line mode, so the edges are anti-aliased
                gl.glPolygonMode(gl.GL_FRONT_AND_BACK, gl.GL_LINE)
                gl.glBegin(gl.GL_QUADS)

                gl.glVertex3f(0.25 * w, h, 0.0)  # Draw Rectangle
                gl.glVertex3f(-w, h, 0.0)
                gl.glVertex3f(-w, -h, 0.0)
                gl.glVertex3f(0.25 * w, -h, 0.0)
                gl.glVertex3f(1.00 * w, 0.0 * h, 0.0)  # Draw Triangle
                gl.glVertex3f(0.25 * w, -3.0 * h, 0.0)
                gl.glVertex3f(0.25 * w, 3.0 * h, 0.0)
                gl.glEnd()  # GL_QUADS

                # Set the polygon mode back to fill mode
                gl.glPolygonMode(gl.GL_FRONT_AND_BACK, gl.GL_FILL)
                gl.glDisable(gl.GL_LINE_SMOOTH)
            gl.glPopMatrix()