File: color_table.i

package info (click to toggle)
pyopengl 2.0.1.08-5.1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 19,484 kB
  • ctags: 9,036
  • sloc: pascal: 64,950; xml: 28,088; ansic: 20,696; python: 19,761; tcl: 668; makefile: 240; sh: 25
file content (225 lines) | stat: -rw-r--r-- 9,035 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
/*
# BUILD api_versions [0x120]
*/

%module color_table

#define __version__ "$Revision: 1.1 $"
#define __date__ "$Date: 2001/12/11 20:08:49 $"
#define __api_version__ API_VERSION
#define __author__ "Tarn Weisner Burton <twburton@users.sourceforge.net>"
#define __doc__ "http:\057\057oss.sgi.com\057projects\057ogl-sample\057registry\057SGI\057color_table.txt"

%{
/**
 *
 * GL.EXT.color_table Module for PyOpenGL
 * 
 * Date: December 2001
 *
 * Authors: Tarn Weisner Burton <twburton@users.sourceforge.net>
 * 
***/
%}

%include util.inc

/* turn the exception handler on */
GL_EXCEPTION_HANDLER()

%{
#if !EXT_DEFINES_PROTO || !defined(GL_EXT_color_table)
DECLARE_VOID_EXT(glColorTableEXT,\
	(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void* table),\
	(target, internalformat, width, format, type, table))
DECLARE_VOID_EXT(glCopyColorTableEXT,\
	(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width),\
	(target, internalformat, x, y, width))
DECLARE_VOID_EXT(glColorTableParameterivEXT,\
	(GLenum target, GLenum pname, const GLint* params),\
	(target, pname, params))
DECLARE_VOID_EXT(glColorTableParameterfvEXT,\
	(GLenum target, GLenum pname, const GLfloat* params),\
	(target, pname, params))
DECLARE_VOID_EXT(glGetColorTableEXT,\
	(GLenum target, GLenum format, GLenum type, void* table),\
	(target, format, type, table))
DECLARE_VOID_EXT(glGetColorTableParameterivEXT,\
	(GLenum target, GLenum pname, GLint* params),\
	(target, pname, params))
DECLARE_VOID_EXT(glGetColorTableParameterfvEXT,\
	(GLenum target, GLenum pname, GLfloat* params),\
	(target, pname, params))
#endif

#ifndef GL_COLOR_TABLE_WIDTH_EXT
#define GL_COLOR_TABLE_WIDTH_EXT 0x80D9
#endif
%}

void glColorTableEXT(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void* buffer);
DOC(glColorTableEXT, "glColorTableEXT(target, internalformat, width, format, type, table) -> None")

%{
void _glColorTableEXT(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void* table)
{
	SetupPixelWrite(1);
	glColorTableEXT(target, internalformat, width, format, type, table);
}
%}

%name(glColorTableubEXT) void _glColorTableEXT(GLenum target, GLenum internalformat, GLsizei d_5_0, GLenum format, GLenum type_UNSIGNED_BYTE, const GLubyte* table);
DOC(glColorTableubEXT, "glColorTableubEXT(target, internalFormat, format, table[] | table[][]) -> None")

%name(glColorTablebEXT) void _glColorTableEXT(GLenum target, GLenum internalformat, GLsizei d_5_0, GLenum format, GLenum type_BYTE, const GLbyte* table);
DOC(glColorTablebEXT, "glColorTablebEXT(target, internalFormat, format, table[] | table[][]) -> None")

%name(glColorTableusEXT) void _glColorTableEXT(GLenum target, GLenum internalformat, GLsizei d_5_0, GLenum format, GLenum type_UNSIGNED_SHORT, const GLushort* table);
DOC(glColorTableusEXT, "glColorTableusEXT(target, internalFormat, format, table[] | table[][]) -> None")

%name(glColorTablesEXT) void _glColorTableEXT(GLenum target, GLenum internalformat, GLsizei d_5_0, GLenum format, GLenum type_SHORT, const GLshort* table);
DOC(glColorTablesEXT, "glColorTablesEXT(target, internalFormat, format, table[] | table[][]) -> None")

%name(glColorTableuiEXT) void _glColorTableEXT(GLenum target, GLenum internalformat, GLsizei d_5_0, GLenum format, GLenum type_UNSIGNED_INT, const GLuint* table);
DOC(glColorTableuiEXT, "glColorTableuiEXT(target, internalFormat, format, table[] | table[][]) -> None")

%name(glColorTableiEXT) void _glColorTableEXT(GLenum target, GLenum internalformat, GLsizei d_5_0, GLenum format, GLenum type_INT, const GLint* table);
DOC(glColorTableiEXT, "glColorTableiEXT(target, internalFormat, format, table[] | table[][]) -> None")

%name(glColorTablefEXT) void _glColorTableEXT(GLenum target, GLenum internalformat, GLsizei d_5_0, GLenum format, GLenum type_FLOAT, const GLfloat* table);
DOC(glColorTablefEXT, "glColorTablefEXT(target, internalFormat, format, table[] | table[][]) -> None")

void glCopyColorTableEXT(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
DOC(glCopyColorTableEXT, "glCopyColorTableEXT(target, internalformat, x, y, width) -> None")

void glColorTableParameterivEXT(GLenum target, GLenum pname, const GLint* params);
DOC(glColorTableParameterivEXT, "glColorTableParameterivEXT(target, pname, params) -> None")

void glColorTableParameterfvEXT(GLenum target, GLenum pname, const GLfloat* params);
DOC(glColorTableParameterfvEXT, "glColorTableParameterfvEXT(target, pname, params) -> None")

void glGetColorTableParameterivEXT(GLenum target, GLenum pname, GLint params[4]);
DOC(glGetColorTableParameterivEXT, "glGetColorTableParameterivEXT(target, pname) -> params")

void glGetColorTableParameterfvEXT(GLenum target, GLenum pname, GLfloat params[4]);
DOC(glGetColorTableParameterfvEXT, "glGetColorTableParameterfvEXT(target, pname) -> params")

%{
PyObject* _glGetColorTableEXT(GLenum target, GLenum format, GLenum type)
{
	PyObject* result;
	int size;
	GLint dims[1];
	void* data = NULL;
	
	glGetColorTableParameterivEXT(target, GL_COLOR_TABLE_WIDTH_EXT, dims);

	data = SetupRawPixelRead(format, type, 1, dims, &size);
	if (!data) return NULL;
	
	glGetColorTableEXT(target, format, type, data);
	result = PyString_FromStringAndSize((const char*)data, size);
	PyMem_Del(data);

	return result;
}
%}

%name(glGetColorTableEXT) PyObject* _glGetColorTableEXT(GLenum target, GLenum format, GLenum type);
DOC(glGetColorTableEXT, "glGetColorTableEXT(target, format, type) -> pixels")

%{
PyObject* __glGetColorTableEXT(GLenum target, GLenum format, GLenum type)
{
	int dims[2];
	void* data;

	glGetColorTableParameterivEXT(target, GL_COLOR_TABLE_WIDTH_EXT, dims);

	data = SetupPixelRead(1, format, type, dims);
	if (!data) return NULL;

	glGetColorTableEXT(target, format, type, data);
	
	return _PyObject_FromArray(type, (dims[1] == 1) ? 1 : 2, dims, data, 1);
}
%}

%name(glGetColorTableubEXT) PyObject* __glGetColorTableEXT(GLenum target, GLenum format, GLenum type_UNSIGNED_BYTE);
DOC(glGetColorTableubEXT, "glGetColorTableubEXT(target, format, type) -> pixels[] | pixels[][]")

%name(glGetColorTablebEXT) PyObject* __glGetColorTableEXT(GLenum target, GLenum format, GLenum type_BYTE);
DOC(glGetColorTablebEXT, "glGetColorTablebEXT(target, format, type) -> pixels[] | pixels[][]")

%name(glGetColorTableusEXT) PyObject* __glGetColorTableEXT(GLenum target, GLenum format, GLenum type_UNSIGNED_SHORT);
DOC(glGetColorTableusEXT, "glGetColorTableusEXT(target, format, type) -> pixels[] | pixels[][]")

%name(glGetColorTablesEXT) PyObject* __glGetColorTableEXT(GLenum target, GLenum format, GLenum type_SHORT);
DOC(glGetColorTablesEXT, "glGetColorTablesEXT(target, format, type) -> pixels[] | pixels[][]")

%name(glGetColorTableuiEXT) PyObject* __glGetColorTableEXT(GLenum target, GLenum format, GLenum type_UNSIGNED_INT);
DOC(glGetColorTableuiEXT, "glGetColorTableuiEXT(target, format, type) -> pixels[] | pixels[][]")

%name(glGetColorTableiEXT) PyObject* __glGetColorTableEXT(GLenum target, GLenum format, GLenum type_INT);
DOC(glGetColorTableiEXT, "glGetColorTableiEXT(target, format, type) -> pixels[] | pixels[][]")

%name(glGetColorTablefEXT) PyObject* __glGetColorTableEXT(GLenum target, GLenum format, GLenum type_FLOAT);
DOC(glGetColorTablefEXT, "glGetColorTablefEXT(target, format) -> pixels[] | pixels[][]")

%{
static char *proc_names[] =
{
#if !EXT_DEFINES_PROTO || !defined(GL_EXT_color_table)
	"glColorTableEXT",
	"glCopyColorTableEXT",
	"glColorTableParameterivEXT",
	"glColorTableParameterfvEXT",
	"glGetColorTableEXT",
	"glGetColorTableParameterivEXT",
	"glGetColorTableParameterfvEXT",
#endif
	NULL
};

#define glInitColorTableEXT() InitExtension("GL_EXT_color_table", proc_names)
%}

GLint glInitColorTableEXT();
DOC(glInitColorTableEXT, "glInitColorTableEXT() -> bool")

%{
PyObject *__info()
{
	if (glInitColorTableEXT())
	{
		PyObject *info = PyList_New(0);
		return info;
	}
	
	Py_INCREF(Py_None);
	return Py_None;
}
%}

PyObject *__info();


#define GL_COLOR_TABLE_EXT					0x80D0
#define GL_POST_CONVOLUTION_COLOR_TABLE_EXT		0x80D1
#define GL_POST_COLOR_MATRIX_COLOR_TABLE_EXT		0x80D2

#define GL_PROXY_COLOR_TABLE_EXT				0x80D3
#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_EXT		0x80D4
#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_EXT		0x80D5

#define GL_COLOR_TABLE_SCALE_EXT				0x80D6
#define GL_COLOR_TABLE_BIAS_EXT				0x80D7

#define GL_COLOR_TABLE_FORMAT_EXT				0x80D8
#define GL_COLOR_TABLE_WIDTH_EXT				0x80D9
#define GL_COLOR_TABLE_RED_SIZE_EXT			0x80DA
#define GL_COLOR_TABLE_GREEN_SIZE_EXT			0x80DB
#define GL_COLOR_TABLE_BLUE_SIZE_EXT			0x80DC
#define GL_COLOR_TABLE_ALPHA_SIZE_EXT			0x80DD
#define GL_COLOR_TABLE_LUMINANCE_SIZE_EXT			0x80DE
#define GL_COLOR_TABLE_INTENSITY_SIZE_EXT			0x80DF