File: _lookupint.py

package info (click to toggle)
pyopengl 3.1.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 11,216 kB
  • sloc: python: 80,468; makefile: 4
file content (21 lines) | stat: -rw-r--r-- 616 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
"""Integer values looked up via glGetIntegerv( constant )"""
import ctypes
_get = None

class LookupInt( object ):
    def __init__( self, lookup, format=ctypes.c_int ):
        self.lookup = lookup 
        self.format = format
    def __int__( self ):
        global _get
        if _get is None:
            from OpenGL.GL import glGetIntegerv
            _get = glGetIntegerv
        output = self.format()
        _get( self.lookup, output )
        return output.value
    def __eq__( self, other ):
        return int(self) == other
    def __cmp__( self, other ):
        return cmp( int(self), other )