Skip to content

Commit

Permalink
RF: relocate _shadersPyglet -> visual._shaders.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremygray committed Dec 6, 2015
1 parent b8d2fe7 commit c8f6351
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 167 deletions.
156 changes: 0 additions & 156 deletions psychopy/_shadersPygame.NOT_USED

This file was deleted.

2 changes: 1 addition & 1 deletion psychopy/hardware/crs/shaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# It is, for example, Mario's idea to add the 0.01 to avoid rounding issues

from __future__ import absolute_import
from psychopy._shadersPyglet import compileProgram, vertSimple
from psychopy.visual._shaders import compileProgram, vertSimple

bitsMonoModeFrag="""
/* Mono++ output formatter
Expand Down
8 changes: 7 additions & 1 deletion psychopy/_shadersPyglet.py → psychopy/visual/_shaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
# Copyright (C) 2015 Jonathan Peirce
# Distributed under the terms of the GNU General Public License (GPL).

from ctypes import byref, cast, c_int, c_char, c_char_p, POINTER, create_string_buffer
"""shaders programs for either pyglet or pygame
"""

from __future__ import absolute_import

from ctypes import (byref, cast, c_int, c_char, c_char_p,
POINTER, create_string_buffer)
import pyglet
GL=pyglet.gl
import sys
Expand Down
12 changes: 7 additions & 5 deletions psychopy/visual/secondorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
# other calls to pyglet or pyglet submodules, otherwise it may not get picked
# up by the pyglet GL engine and have no effect.
# Shaders will work but require OpenGL2.0 drivers AND PyOpenGL3.0+

from __future__ import absolute_import

import pyglet
pyglet.options['debug_gl'] = False
import ctypes
Expand All @@ -22,10 +25,10 @@

from psychopy.tools.arraytools import val2array
from psychopy.tools.attributetools import attributeSetter
from psychopy.visual.grating import GratingStim
from .grating import GratingStim
import numpy

import psychopy._shadersPyglet as _shaders
from . import _shaders

#we need a different shader program for this (3 textures)
carrierEnvelopeMaskFrag = '''
Expand Down Expand Up @@ -436,7 +439,7 @@ def _updateListNoShaders(self):
GL.glMultiTexCoord2f(GL.GL_TEXTURE2,Rmask,Tmask)
GL.glVertex2f(vertsPix[3,0], vertsPix[3,1])
GL.glEnd()

#disable mask
GL.glActiveTextureARB(GL.GL_TEXTURE2_ARB)
GL.glDisable(GL.GL_TEXTURE_2D)
Expand All @@ -461,7 +464,7 @@ def clearTextures(self):
GL.glDeleteTextures(1, self._carrierID)
GL.glDeleteTextures(1, self._envelopeID)
GL.glDeleteTextures(1, self._maskID)

def _calcEnvCyclesPerStim(self):

if self.units in ['norm', 'height']:
Expand All @@ -470,4 +473,3 @@ def _calcEnvCyclesPerStim(self):
else:
#self._cycles = self.sf * self.size
self._envcycles = self.envsf * self.size

10 changes: 6 additions & 4 deletions psychopy/visual/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
# Copyright (C) 2015 Jonathan Peirce
# Distributed under the terms of the GNU General Public License (GPL).

from __future__ import absolute_import

import sys
import os
import weakref
Expand Down Expand Up @@ -56,9 +58,9 @@
from psychopy.tools.attributetools import attributeSetter, setAttribute
from psychopy.tools.arraytools import val2array
from psychopy import makeMovies
from psychopy.visual.text import TextStim
from psychopy.visual.grating import GratingStim
from psychopy.visual.helpers import setColor
from .text import TextStim
from .grating import GratingStim
from .helpers import setColor
from . import glob_vars

try:
Expand All @@ -80,7 +82,7 @@

from psychopy.gamma import getGammaRamp, setGammaRamp, setGamma
#import pyglet.gl, pyglet.window, pyglet.image, pyglet.font, pyglet.event
import psychopy._shadersPyglet as _shaders
from . import _shaders
try:
from pyglet import media
havePygletMedia = True
Expand Down

0 comments on commit c8f6351

Please sign in to comment.