File: test_instanced_draw_detect.py

package info (click to toggle)
pyopengl 3.1.6%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 14,732 kB
  • sloc: python: 106,016; makefile: 8
file content (35 lines) | stat: -rw-r--r-- 896 bytes parent folder | download | duplicates (2)
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
from __future__ import print_function
from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.extensions import alternate
from OpenGL.GL.ARB.draw_instanced import *
from OpenGL.GL.EXT.draw_instanced import *

def detect():
    glutInit([])
    glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH)
    glutInitWindowSize(200,200)

    glutCreateWindow("Detection")
    
    functions = (
        glDrawArraysInstanced, 
        glDrawArraysInstancedARB, 
        glDrawArraysInstancedEXT,
        #glDrawArraysInstancedNV, is GLES only
    )
    
    for function in functions:
        print(function.__name__, bool(function))
    
    any = alternate( *functions )
    
    print(any, bool(any))
    try:
        if fgDeinitialize: fgDeinitialize(False)
    except NameError:
        pass # Older PyOpenGL, you may see a seg-fault here...
    

if __name__ == "__main__":
    detect()