OpenGL now depends on the availability of PIL

This commit is contained in:
Skyler Lehmkuhl 2012-03-30 14:33:19 -04:00
parent c3ef57dee3
commit 255b240fd7
1 changed files with 5 additions and 3 deletions

View File

@ -12,6 +12,7 @@ import platform
import re import re
try: try:
from PIL import Image as PILimage from PIL import Image as PILimage
GLEnablable = True
except ImportError: except ImportError:
GLEnablable = False GLEnablable = False
@ -44,8 +45,9 @@ FRAMERATE=50
#Width and height are the width and height of the document #Width and height are the width and height of the document
WIDTH, HEIGHT = 500, 500 WIDTH, HEIGHT = 500, 500
#Whether we are using OpenGL for rendering. #Whether we are using OpenGL for rendering. Currently we need PIL for this.
USING_GL = True if GLEnablable:
USING_GL = True
#Object which has the keyboard focus. #Object which has the keyboard focus.
FOCUS = None FOCUS = None
@ -1165,9 +1167,9 @@ class Image(object):
self.name = image.split(sep)[-1] self.name = image.split(sep)[-1]
self.iname = None self.iname = None
self.path = image self.path = image
self.pilimage = PILimage.open(image)
self.type="Image" self.type="Image"
if USING_GL: if USING_GL:
self.pilimage = PILimage.open(image)
# This is an OpenGL texture ID. # This is an OpenGL texture ID.
self.gltexture = self.loadGLImage(file = image) self.gltexture = self.loadGLImage(file = image)