[visionegg] opengl issue
- From: Jin Yi <jyi@xxxxxxxxx>
- To: visionegg@xxxxxxxxxxxxx
- Date: Tue, 13 Apr 2004 15:50:57 -0400
i'm trying to use visionegg for displaying text screens. i have this
working if i approach the python code as a script.
for better software engineering, i've started to modularize my code into
classes. when i do this, this weird error pops up:
------------------------
2004-04-12 20:10:06,967 (1372) CRITICAL: Traceback (most recent call last):
File "C:\Pylink\work\Experiment.py", line 72, in ?
exp.parser.CreateStimuli()
File "C:\Pylink\work\Parsers.py", line 81, in CreateStimuli
text = VisionEgg.Text.Text(text = line, **params)
File "C:\Python22\lib\site-packages\VisionEgg\Text.py", line 154, in __init__
VisionEgg.Textures.TextureStimulus.__init__(self,**kw)
File "C:\Python22\lib\site-packages\VisionEgg\Textures.py", line 1312, in __in
it__
TextureStimulusBaseClass.__init__(self,**kw)
File "C:\Python22\lib\site-packages\VisionEgg\Textures.py", line 1061, in __in
it__
self.parameters.texture_wrap_s = gl.GL_CLAMP_TO_EDGE
AttributeError: 'module' object has no attribute 'GL_CLAMP_TO_EDGE'
Traceback (most recent call last):
File "C:\Pylink\work\Experiment.py", line 72, in ?
exp.parser.CreateStimuli()
File "C:\Pylink\work\Parsers.py", line 81, in CreateStimuli
text = VisionEgg.Text.Text(text = line, **params)
File "C:\Python22\lib\site-packages\VisionEgg\Text.py", line 154, in __init__
VisionEgg.Textures.TextureStimulus.__init__(self,**kw)
File "C:\Python22\lib\site-packages\VisionEgg\Textures.py", line 1312, in __in
it__
TextureStimulusBaseClass.__init__(self,**kw)
File "C:\Python22\lib\site-packages\VisionEgg\Textures.py", line 1061, in __in
it__
self.parameters.texture_wrap_s = gl.GL_CLAMP_TO_EDGE
AttributeError: 'module' object has no attribute 'GL_CLAMP_TO_EDGE'
-----------------
when i run checkconfig.py it says that everything is fine, and like i've
said, running my old script version of the program is fine.
here's the Parsers.py file that does the instantiation:
--------------------------
#!/usr/bin/env python
"""
various materials parsers and the generic material parser
please understand how to use regular expressions in python:
http://diveintopython.org/regular_expressions/index.html
http://www.amk.ca/python/howto/regex/regex.html
written by jyi@xxxxxxxxx
"""
import string
import re
import VisionEgg.Text
from functions import *
class generic:
" generic parser... you need to inherit from this "
def __init__(self, config):
self.file = config.get('Filename','materials')
self.__read()
self.stims = []
self.yspace = config.get('TextBox','yspace')
self.w = config.getint('Screen','w')
self.h = config.getint('Screen','h')
if config.get('TextBox','align') == 'center':
anch = 'center'
pos = (self.w/2, self.h/2),
else:
anch = 'lowerleft'
x = config.getint('TextBox','x')
y = config.getint('TextBox','y')
pos = (x, self.h-y)
self.textparams = {
'color' : convIntList(config.get('Screen','fg')),
'font_name' : config.get('Font','name'),
'font_size' : config.getint('Font','size'),
'position' : pos,
'anchor' : anch
}
def __read(self):
" private: reads-in the materials file "
print "reading materials from", self.file
try:
f = open(self.file, 'r')
self.lines = map(chomp, f.readlines())
f.close()
except IOError, (errno, strerror):
print "### Error I/O (%s): %s" % (errno, strerror)
def CreateStimuli(self):
" the generic screens are separated by % "
params = self.textparams
tmpstim = []
for line in self.lines:
if line == '%':
xpos = self.textparams['position'][0]
ypos = self.textparams['position'][1]
if self.textparams['anchor'] == 'center':
nLines = len(tmpstim)
if nLines > 1:
lineheight = tmpstim[0].parameters.size[1]
totsize = nLines*lineheight + (nLines-1)*self.yspace
ypos += totsize/2
for i in range(0, nLines):
tmpstim[i].set(position=(xpos, ypos))
ypos -= lineheight + yspace
else:
for i in range(0, len(tmpstim)):
ypos -= tmpstim[i].parameters.size[1]
tmpstim[i].set(position=(xpos, ypos))
ypos -= self.yspace
self.stims.append(tmpstim)
tmpstim = []
else:
if line == '': line = ' ' # fix blankspaces in materials
text = VisionEgg.Text.Text(text = line, **params)
tmpstim.append(text)
-------------------
help.
======================================
The Vision Egg mailing list
Archives: http://www.freelists.org/archives/visionegg
Website: http://www.visionegg.org/mailinglist.html
- Follow-Ups:
- [visionegg] Re: opengl issue
- From: Andrew Straw
Other related posts:
- » [visionegg] opengl issue
- » [visionegg] Re: opengl issue
- » [visionegg] Re: opengl issue
- [visionegg] Re: opengl issue
- From: Andrew Straw