File: name_gen_delete.py

package info (click to toggle)
pyopengl 3.1.5%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 14,668 kB
  • sloc: python: 108,024; makefile: 4
file content (52 lines) | stat: -rw-r--r-- 1,909 bytes parent folder | download | duplicates (15)
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
46
47
48
49
50
51
52
'''OpenGL extension AMD.name_gen_delete

This module customises the behaviour of the 
OpenGL.raw.GL.AMD.name_gen_delete to provide a more 
Python-friendly API

Overview (from the spec)
	
	This extension simply creates 2 new entry-points that name generic
	creation and deletion of names.  The intent is to go away from API
	functionality that provides a create/delete function for each specific 
	object.  
	
	For example: 
	    glGenTextures/glDeleteTextures/glIsTexture
	    glGenBuffers/glDeleteBuffers/IsBuffer
	    glGenFramebuffers/glDeleteFramebuffers/IsFramebuffer
	
	Instead, everything is created using one entry-point GenNamesAMD and
	everything is now deleted with another entry-point DeleteNamesAMD with
	the appropriate identifier set.  In addition, everything can now be 
	queried with IsNameAMD.
	
	This alleviates the problem we may eventually encounter where we have
	many Gen/Delete/Is functions where 3 might suffice.  All that is needed
	in the new case is to add a valid identifier to the accepted parameters
	list.
	

The official definition of this extension is available here:
http://www.opengl.org/registry/specs/AMD/name_gen_delete.txt
'''
from OpenGL import platform, constant, arrays
from OpenGL import extensions, wrapper
import ctypes
from OpenGL.raw.GL import _types, _glgets
from OpenGL.raw.GL.AMD.name_gen_delete import *
from OpenGL.raw.GL.AMD.name_gen_delete import _EXTENSION_NAME

def glInitNameGenDeleteAMD():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )

glGenNamesAMD=wrapper.wrapper(glGenNamesAMD).setOutput(
    'names',size=lambda x:(x,),pnameArg='num',orPassIn=True
)
# INPUT glDeleteNamesAMD.names size not checked against num
glDeleteNamesAMD=wrapper.wrapper(glDeleteNamesAMD).setInputArraySize(
    'names', None
)
### END AUTOGENERATED SECTION