blob: 7aef2230487c96f03219ff05fcef29ebb881d1e7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# Copyright 2004-2008 Nanorex, Inc. See LICENSE file for details.
"""
gl_GLE.py - Details of loading the GLE functions.
@version: $Id$
@copyright: 2004-2008 Nanorex, Inc. See LICENSE file for details.
History:
russ 080523: Factored out duplicate code from CS_draw_primitives.py,
CS_workers.py, and drawers.py .
"""
try:
from OpenGL.GLE import glePolyCone, gleGetNumSides, gleSetNumSides
except:
print "GLE module can't be imported. Now trying _GLE"
from OpenGL._GLE import glePolyCone, gleGetNumSides, gleSetNumSides
# Check if the gleGet/SetNumSides function is working on this install, and if
# not, patch it to call gleGet/SetNumSlices. Checking method is as recommended
# in an OpenGL exception reported by Brian [070622]:
# OpenGL.error.NullFunctionError: Attempt to call an
# undefined function gleGetNumSides, check for
# bool(gleGetNumSides) before calling
# The underlying cause of this (described by Brian) is that the computer's
# OpenGL has the older gleGetNumSlices (so it supports the functionality), but
# PyOpenGL binds (only) to the newer gleGetNumSides. I [bruce 070629] think
# Brian said this is only an issue on Macs.
if not bool(gleGetNumSides):
# russ 080522: Replaced no-op functions with a patch.
print "fyi: Patching gleGetNumSides to call gleGetNumSlices instead."
from graphics.drawing.gleNumSides_patch import gleGetNumSides
from graphics.drawing.gleNumSides_patch import gleSetNumSides
# russ 081227: The no-ops may still be needed, e.g. on Fedora 10 Linux.
try:
gleGetNumSides()
except:
print "fyi: Neither gleGetNumSides nor gleGetNumSlices is supported."
print "fyi: No-ops will be used for gleGetNumSides and gleSetNumSides."
gleGetNumSides = int
gleSetNumSides = int
pass
pass
|