From 6edf23c97c5044ba4ec1719965d107842ad49364 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Mon, 4 May 2009 10:20:52 +0100 Subject: [PATCH] Dump glClear and glBegin arguments correctly. --- base.py | 13 +++++++++++++ gl.py | 15 +++++++++------ opengl32.py | 4 ++-- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/base.py b/base.py index 2678ab8..5cf8c77 100644 --- a/base.py +++ b/base.py @@ -176,6 +176,19 @@ class Enum(Concrete): print ' }' +class FakeEnum(Enum): + + __seq = 0 + + def __init__(self, type, values): + FakeEnum.__seq += 1 + Enum.__init__(self, type.name + str(FakeEnum.__seq), values) + self.type = type + + def __str__(self): + return str(self.type) + + class Flags(Concrete): __seq = 0 diff --git a/gl.py b/gl.py index 5f2f8d8..1acfce1 100644 --- a/gl.py +++ b/gl.py @@ -804,7 +804,7 @@ GLenum = Enum("GLenum", [ # "GL_MAX_TEXTURE_UNITS_ARB", # 0x84E2 ]) -[ +GLprimenum = FakeEnum(GLenum, [ "GL_POINTS", # 0x0000 "GL_LINES", # 0x0001 "GL_LINE_LOOP", # 0x0002 @@ -815,7 +815,14 @@ GLenum = Enum("GLenum", [ "GL_QUADS", # 0x0007 "GL_QUAD_STRIP", # 0x0008 "GL_POLYGON", # 0x0009 -] +]) + +GLbufferbitfield = Flags(GLbitfield, [ + "GL_DEPTH_BUFFER_BIT", # 0x00000100 + "GL_ACCUM_BUFFER_BIT", # 0x00000200 + "GL_STENCIL_BUFFER_BIT", # 0x00000400 + "GL_COLOR_BUFFER_BIT", # 0x00004000 +]) [ "GL_ALL_ATTRIB_BITS", # 0x000FFFFF @@ -827,13 +834,9 @@ GLenum = Enum("GLenum", [ "GL_PIXEL_MODE_BIT", # 0x00000020 "GL_LIGHTING_BIT", # 0x00000040 "GL_FOG_BIT", # 0x00000080 - "GL_DEPTH_BUFFER_BIT", # 0x00000100 - "GL_ACCUM_BUFFER_BIT", # 0x00000200 - "GL_STENCIL_BUFFER_BIT", # 0x00000400 "GL_VIEWPORT_BIT", # 0x00000800 "GL_TRANSFORM_BIT", # 0x00001000 "GL_ENABLE_BIT", # 0x00002000 - "GL_COLOR_BUFFER_BIT", # 0x00004000 "GL_HINT_BIT", # 0x00008000 "GL_EVAL_BIT", # 0x00010000 "GL_LIST_BIT", # 0x00020000 diff --git a/opengl32.py b/opengl32.py index 0fe9225..992517a 100644 --- a/opengl32.py +++ b/opengl32.py @@ -29,7 +29,7 @@ opengl32.functions += [ Function(Void, "glDeleteLists", [(GLuint, "list"), (GLsizei, "range")]), Function(GLuint, "glGenLists", [(GLsizei, "range")]), Function(Void, "glListBase", [(GLuint, "base")]), - Function(Void, "glBegin", [(GLenum, "mode")]), + Function(Void, "glBegin", [(GLprimenum, "mode")]), Function(Void, "glBitmap", [(GLsizei, "width"), (GLsizei, "height"), (GLfloat, "xorig"), (GLfloat, "yorig"), (GLfloat, "xmove"), (GLfloat, "ymove"), (Pointer(Const(GLubyte)), "bitmap")]), Function(Void, "glColor3b", [(GLbyte, "red"), (GLbyte, "green"), (GLbyte, "blue")]), Function(Void, "glColor3bv", [(Pointer(Const(GLbyte)), "v")]), @@ -225,7 +225,7 @@ opengl32.functions += [ Function(Void, "glPopName", []), Function(Void, "glPushName", [(GLuint, "name")]), Function(Void, "glDrawBuffer", [(GLenum, "mode")]), - Function(Void, "glClear", [(GLbitfield, "mask")]), + Function(Void, "glClear", [(GLbufferbitfield, "mask")]), Function(Void, "glClearAccum", [(GLfloat, "red"), (GLfloat, "green"), (GLfloat, "blue"), (GLfloat, "alpha")]), Function(Void, "glClearIndex", [(GLfloat, "c")]), Function(Void, "glClearColor", [(GLclampf, "red"), (GLclampf, "green"), (GLclampf, "blue"), (GLclampf, "alpha")]), -- 2.45.2