File: __init__.py

package info (click to toggle)
python-opengl 1.5.7-5.3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 2,192 kB
  • ctags: 3,971
  • sloc: ansic: 18,030; python: 8,909; tcl: 328; cpp: 211; makefile: 115; sh: 24
file content (41 lines) | stat: -rw-r--r-- 1,176 bytes parent folder | download
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
# $Id: __init__.py,v 1.5 2000/11/02 13:13:43 rliebscher Exp $
import sys
import OpenGL
if OpenGL._numeric:
    from Numeric import ArrayType
    try:
        import OpenGL.dynload._glu_num
        #print OpenGL.dynload._glu_num
        _glu = OpenGL.dynload._glu_num
    except ImportError:
        import OpenGL.dynload._glu
        #print OpenGL.dynload._glu
        _glu = OpenGL.dynload._glu
else:
    import OpenGL.dynload._glu
    #print OpenGL.dynload._glu
    _glu = OpenGL.dynload._glu

from gluconst import *
from OpenGL.GL import Error, CarefulFunction

origdict = _glu.__dict__.copy()
sys.modules['OpenGL.GLU'].__dict__.update(origdict)

carefuldict = {}
for name, func in origdict.items():
    if callable(func):
        carefuldict[name] = CarefulFunction(name, func)
# These do the same sorts of things that the C versions would

def careful():
    cd = carefuldict.copy()
    if cd.has_key('error'): del cd['error']
    sys.modules['OpenGL.GLU'].__dict__.update(cd)

import string
def fast():
    cd = origdict.copy()
    if cd.has_key('error'): del cd['error']
    if cd.has_key('glconst'): del cd['glconst']
    sys.modules['OpenGL.GLU'].__dict__.update(cd)