File: WGL__init__.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 (421 lines) | stat: -rw-r--r-- 11,450 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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
/*
# BUILD api_versions [0x400]
# BUILD shadow 1
# BUILD macro_template 'WINVER >= 0x%(api_version)x'
# BUILD gl_platforms ['WGL']
# BUILD libs ['gdi32']
# BUILD api_version_check 1
*/

%module WGL__init__

#define __version__ "$Revision: 1.1 $"
#define __date__ "$Date: 2003/10/19 04:02:35 $"
#define __api_version__ API_VERSION
#define __author__ "Tarn Weisner Burton <twburton@users.sourceforge.net>"
#define __doc__ "This module provides access to the WGL API.\n\
\n\
Documentation:\n\
    MSDN:  http:\057\057msdn.microsoft.com/library/?url=/library/en-us/opengl/hh/opengl/ntopnglo_0e0o.asp?frame=true"

%{
/**
 *
 * WGL Module for PyOpenGL
 * 
 * Date: May 2001
 *
 * Authors: Tarn Weisner Burton <twburton@users.sourceforge.net>
 * 
***/
%}

%include WGL/util.inc

WGL_EXCEPTION_HANDLER()

/* OpenGL wgl prototypes */

/* Pixel format descriptor */
typedef struct tagPIXELFORMATDESCRIPTOR
{
 WORD nSize;
 WORD nVersion;
 DWORD dwFlags;
 BYTE iPixelType;
 BYTE cColorBits;
 BYTE cRedBits;
 BYTE cRedShift;
 BYTE cGreenBits;
 BYTE cGreenShift;
 BYTE cBlueBits;
 BYTE cBlueShift;
 BYTE cAlphaBits;
 BYTE cAlphaShift;
 BYTE cAccumBits;
 BYTE cAccumRedBits;
 BYTE cAccumGreenBits;
 BYTE cAccumBlueBits;
 BYTE cAccumAlphaBits;
 BYTE cDepthBits;
 BYTE cStencilBits;
 BYTE cAuxBuffers;
 BYTE iLayerType;
 BYTE bReserved;
 DWORD dwLayerMask;
 DWORD dwVisibleMask;
 DWORD dwDamageMask;
} PIXELFORMATDESCRIPTOR;

%{
PIXELFORMATDESCRIPTOR* new_PIXELFORMATDESCRIPTOR()
{
	PIXELFORMATDESCRIPTOR *result = PyMem_New(PIXELFORMATDESCRIPTOR, 1);
	memset(result, 0, sizeof(PIXELFORMATDESCRIPTOR));
	result->nSize = sizeof(PIXELFORMATDESCRIPTOR);
	result->nVersion = 1;
	return result;
}

void delete_PIXELFORMATDESCRIPTOR(PIXELFORMATDESCRIPTOR *x)
{
	PyMem_Del(x);
}
%}

%extend PIXELFORMATDESCRIPTOR
{
	PIXELFORMATDESCRIPTOR();
	~PIXELFORMATDESCRIPTOR();
}

/* pixel types */
#define PFD_TYPE_RGBA 0
#define PFD_TYPE_COLORINDEX 1

/* layer types */
#define PFD_MAIN_PLANE 0
#define PFD_OVERLAY_PLANE 1
#define PFD_UNDERLAY_PLANE (-1)

/* PIXELFORMATDESCRIPTOR flags */
#define PFD_DOUBLEBUFFER 0x00000001
#define PFD_STEREO 0x00000002
#define PFD_DRAW_TO_WINDOW 0x00000004
#define PFD_DRAW_TO_BITMAP 0x00000008
#define PFD_SUPPORT_GDI 0x00000010
#define PFD_SUPPORT_OPENGL 0x00000020
#define PFD_GENERIC_FORMAT 0x00000040
#define PFD_NEED_PALETTE 0x00000080
#define PFD_NEED_SYSTEM_PALETTE 0x00000100
#define PFD_SWAP_EXCHANGE 0x00000200
#define PFD_SWAP_COPY 0x00000400
#define PFD_SWAP_LAYER_BUFFERS 0x00000800
#define PFD_GENERIC_ACCELERATED 0x00001000
#define PFD_SUPPORT_DIRECTDRAW 0x00002000

/* PIXELFORMATDESCRIPTOR flags for use in ChoosePixelFormat only */
#define PFD_DEPTH_DONTCARE 0x20000000
#define PFD_DOUBLEBUFFER_DONTCARE 0x40000000
#define PFD_STEREO_DONTCARE 0x80000000

typedef struct _POINTFLOAT {
 FLOAT x;
 FLOAT y;
} POINTFLOAT, *PPOINTFLOAT;

%extend POINTFLOAT
{
	POINTFLOAT()
	{
		POINTFLOAT *result = PyMem_New(POINTFLOAT, 1);
		memset(result, 0, sizeof(POINTFLOAT));
		return result;
	}
	
	~POINTFLOAT()
	{
		PyMem_Del(self);
	}
}

typedef struct _GLYPHMETRICSFLOAT {
 FLOAT gmfBlackBoxX;
 FLOAT gmfBlackBoxY;
 POINTFLOAT gmfptGlyphOrigin;
 FLOAT gmfCellIncX;
 FLOAT gmfCellIncY;
} GLYPHMETRICSFLOAT;

%{
GLYPHMETRICSFLOAT* new_GLYPHMETRICSFLOAT()
{
	GLYPHMETRICSFLOAT *result = PyMem_New(GLYPHMETRICSFLOAT, 1);
	memset(result, 0, sizeof(GLYPHMETRICSFLOAT));
	return result;
}

void delete_GLYPHMETRICSFLOAT(GLYPHMETRICSFLOAT *x)
{
	PyMem_Del(x);
}
%}

%extend GLYPHMETRICSFLOAT
{
	GLYPHMETRICSFLOAT();
	~GLYPHMETRICSFLOAT();
}



#define WGL_FONT_LINES 0
#define WGL_FONT_POLYGONS 1
/* Layer plane descriptor */
typedef struct tagLAYERPLANEDESCRIPTOR { /* lpd */
 WORD nSize;
 WORD nVersion;
 DWORD dwFlags;
 BYTE iPixelType;
 BYTE cColorBits;
 BYTE cRedBits;
 BYTE cRedShift;
 BYTE cGreenBits;
 BYTE cGreenShift;
 BYTE cBlueBits;
 BYTE cBlueShift;
 BYTE cAlphaBits;
 BYTE cAlphaShift;
 BYTE cAccumBits;
 BYTE cAccumRedBits;
 BYTE cAccumGreenBits;
 BYTE cAccumBlueBits;
 BYTE cAccumAlphaBits;
 BYTE cDepthBits;
 BYTE cStencilBits;
 BYTE cAuxBuffers;
 BYTE iLayerPlane;
 BYTE bReserved;
 COLORREF crTransparent;
} LAYERPLANEDESCRIPTOR;

%{
LAYERPLANEDESCRIPTOR* new_LAYERPLANEDESCRIPTOR()
{
	LAYERPLANEDESCRIPTOR *result = PyMem_New(LAYERPLANEDESCRIPTOR, 1);
	memset(result, 0, sizeof(LAYERPLANEDESCRIPTOR));
	result->nSize = sizeof(LAYERPLANEDESCRIPTOR);
	result->nVersion = 1;
	return result;
}

void delete_LAYERPLANEDESCRIPTOR(LAYERPLANEDESCRIPTOR *x)
{
	PyMem_Del(x);
}
%}

%extend LAYERPLANEDESCRIPTOR
{
	LAYERPLANEDESCRIPTOR();
	~LAYERPLANEDESCRIPTOR();
}

/* LAYERPLANEDESCRIPTOR flags */
#define LPD_DOUBLEBUFFER 0x00000001
#define LPD_STEREO 0x00000002
#define LPD_SUPPORT_GDI 0x00000010
#define LPD_SUPPORT_OPENGL 0x00000020
#define LPD_SHARE_DEPTH 0x00000040
#define LPD_SHARE_STENCIL 0x00000080
#define LPD_SHARE_ACCUM 0x00000100
#define LPD_SWAP_EXCHANGE 0x00000200
#define LPD_SWAP_COPY 0x00000400
#define LPD_TRANSPARENT 0x00001000

#define LPD_TYPE_RGBA 0
#define LPD_TYPE_COLORINDEX 1

/* wglSwapLayerBuffers flags */
#define WGL_SWAP_MAIN_PLANE 0x00000001
#define WGL_SWAP_OVERLAY1 0x00000002
#define WGL_SWAP_OVERLAY2 0x00000004
#define WGL_SWAP_OVERLAY3 0x00000008
#define WGL_SWAP_OVERLAY4 0x00000010
#define WGL_SWAP_OVERLAY5 0x00000020
#define WGL_SWAP_OVERLAY6 0x00000040
#define WGL_SWAP_OVERLAY7 0x00000080
#define WGL_SWAP_OVERLAY8 0x00000100
#define WGL_SWAP_OVERLAY9 0x00000200
#define WGL_SWAP_OVERLAY10 0x00000400
#define WGL_SWAP_OVERLAY11 0x00000800
#define WGL_SWAP_OVERLAY12 0x00001000
#define WGL_SWAP_OVERLAY13 0x00002000
#define WGL_SWAP_OVERLAY14 0x00004000
#define WGL_SWAP_OVERLAY15 0x00008000
#define WGL_SWAP_UNDERLAY1 0x00010000
#define WGL_SWAP_UNDERLAY2 0x00020000
#define WGL_SWAP_UNDERLAY3 0x00040000
#define WGL_SWAP_UNDERLAY4 0x00080000
#define WGL_SWAP_UNDERLAY5 0x00100000
#define WGL_SWAP_UNDERLAY6 0x00200000
#define WGL_SWAP_UNDERLAY7 0x00400000
#define WGL_SWAP_UNDERLAY8 0x00800000
#define WGL_SWAP_UNDERLAY9 0x01000000
#define WGL_SWAP_UNDERLAY10 0x02000000
#define WGL_SWAP_UNDERLAY11 0x04000000
#define WGL_SWAP_UNDERLAY12 0x08000000
#define WGL_SWAP_UNDERLAY13 0x10000000
#define WGL_SWAP_UNDERLAY14 0x20000000
#define WGL_SWAP_UNDERLAY15 0x40000000

/*#if API_VERSION >= 1280
#define WGL_SWAPMULTIPLE_MAX 16

typedef struct _WGLSWAP
{
	HDC hdc;
	UINT uiFlags;
} WGLSWAP;


%{
WGLSWAP* new_WGLSWAP()
{
	WGLSWAP *result = PyMem_New(WGLSWAP, 1);
	memset(result, 0, sizeof(WGLSWAP));
	return result;
}

void delete_WGLSWAP(WGLSWAP *x)
{
	PyMem_Del(x);
}
%}

%extend WGLSWAP
{
	WGLSWAP();
	~WGLSWAP();
}

#endif*/


int ChoosePixelFormat(HDC hdc, PIXELFORMATDESCRIPTOR *ppfd);
DOC(ChoosePixelFormat, "ChoosePixelFormat(hdc, ppfd) -> int")

int DescribePixelFormat(HDC hdc, int iPixelFormat, UINT nBytes, PIXELFORMATDESCRIPTOR *ppfd);
DOC(DescribePixelFormat, "DescribePixelFormat(hdc, iPixelFormat, nBytes, ppfd) -> int")

/*UINT GetEnhMetaFilePixelFormat(HENHMETAFILE hemf, UINT cbBuffer, PIXELFORMATDESCRIPTOR *ppfd); */

int GetPixelFormat(HDC hdc);
DOC(GetPixelFormat, "GetPixelFormat(hdc) -> int")

BOOL SetPixelFormat(HDC hdc, int iPixelFormat, PIXELFORMATDESCRIPTOR *ppfd);
DOC(SetPixelFormat, "SetPixelFormat(hdc, iPixelFormat, ppfd) -> int")

BOOL SwapBuffers(HDC hdc);
DOC(SwapBuffers, "SwapBuffers(hdc) -> BOOL")

HGLRC wglCreateContext(HDC hdc);
DOC(wglCreateContext, "wglCreateContext(hdc) -> HGLRC")

HGLRC wglCreateLayerContext(HDC hdc, int iLayerPlane);
DOC(wglCreateLayerContext, "wglCreateLayerContext(hdc, iLayerPlane) -> HGLRC")

BOOL wglCopyContext(HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask);
DOC(wglCopyContext, "wglCopyContext(hglrcSrc, hglrcDst, mask) -> BOOL")

BOOL wglDeleteContext(HGLRC hglrc);
DOC(wglDeleteContext, "wglDeleteContext(hglrc) -> BOOL")

BOOL wglDescribeLayerPlane(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nBytes, LAYERPLANEDESCRIPTOR *plpd);
DOC(wglDescribeLayerPlane, "wglDescribeLayerPlane(hdc, iPixelFormat, iLayerPlane, nBytes, plpd) -> BOOL")

HGLRC wglGetCurrentContext(VOID);
DOC(wglGetCurrentContext, "wglGetCurrentContext() -> HGLRC");

HDC wglGetCurrentDC(VOID);
DOC(wglGetCurrentDC, "wglGetCurrentDC() -> HDC")

/*int wglGetLayerPaletteEntries(HDC hdc, int iLayerPlane, int iStart, int cEntries, COLORREF *pcr); */
%{
PyObject* _wglGetLayerPaletteEntries(HDC hdc, int iLayerPlane, int iStart, int cEntries)
{
	COLORREF *pcr = PyMem_New(COLORREF, cEntries);
	int n = wglGetLayerPaletteEntries(hdc, iLayerPlane, iStart, cEntries, pcr);
	PyObject* result;
	
	if (n == 0)
	{
		Py_INCREF(Py_None);
		return Py_None;
	}
	
	result = _PyTuple_FromUnsignedIntArray(n, pcr);
	PyMem_Del(pcr);
	return result;
}
%}

%name(wglGetLayerPaletteEntries) PyObject* _wglGetLayerPaletteEntries(HDC hdc, int iLayerPlane, int iStart, int cEntries);
DOC(wglGetLayerPaletteEntries, "wglGetLayerPaletteEntries(hdc, iLayerPlane, iStart, cEntries, pcr) -> cr")

PROC wglGetProcAddress(LPCSTR lpszProc);
DOC(wglGetProcAddress, "wglGetProcAddress(lpszProc) -> PROC")

BOOL wglMakeCurrent(HDC hdc, HGLRC hglrc);
DOC(wglMakeCurrent, "wglMakeCurrent(hdc, hglrc) -> BOOL")

BOOL wglRealizeLayerPalette(HDC hdc, int iLayerPlane, BOOL bRealize);
DOC(wglRealizeLayerPalette, "wglRealizeLayerPalette(hdc, iLayerPlane, bRealize) -> BOOL")

int wglSetLayerPaletteEntries(HDC hdc, int iLayerPlane, int iStart, int n_4, CONST COLORREF *pcr);
DOC(wglSetLayerPaletteEntries, "wglSetLayerPaletteEntries(hdc, iLayerPlane, iStart, cEntries, pcr) -> int")

BOOL wglShareLists(HGLRC hglrc1, HGLRC hglrc2);
DOC(wglShareLists, "wglShareLists(hglrc1, hglrc2) -> BOOL")

BOOL wglSwapLayerBuffers(HDC hdc, UINT fuPlanes);
DOC(wglSwapLayerBuffers, "wglSwapLayerBuffers(hdc, fuPlanes) -> BOOL")

/*#if API_VERSION >= 1280 */
/*DWORD wglSwapMultipleBuffers(UINT, CONST WGLSWAP *); */
/*#endif */

BOOL wglUseFontBitmapsA(HDC hdc, DWORD first, DWORD count, DWORD listBase);
DOC(wglUseFontBitmapsA, "wglUseFontBitmapsA(hdc, first, count, listBase) -> BOOL")
BOOL wglUseFontBitmapsW(HDC hdc, DWORD first, DWORD count, DWORD listBase);
DOC(wglUseFontBitmapsW, "wglUseFontBitmapsW(hdc, first, count, listBase) -> BOOL")


%shadow %{
wglUseFontBitmaps = WGL__init___.wglUseFontBitmapsA
%}


BOOL wglUseFontOutlinesA(HDC hdc, DWORD first, DWORD count, DWORD listBase, FLOAT deviation, FLOAT extrusion, int format, GLYPHMETRICSFLOAT *lpgmf);
DOC(wglUseFontOutlinesA, "wglUseFontOutlinesA(hdc, first, count, listBase, deviation, extrusion, formation, lpgmf) -> BOOL")
BOOL wglUseFontOutlinesW(HDC hdc, DWORD first, DWORD count, DWORD listBase, FLOAT deviation, FLOAT extrusion, int format, GLYPHMETRICSFLOAT *lpgmf);
DOC(wglUseFontOutlinesW, "wglUseFontOutlinesW(hdc, first, count, listBase, deviation, extrusion, formation, lpgmf) -> BOOL")

%shadow %{
wglUseFontOutlines = WGL__init___.wglUseFontOutlinesA
%}


%shadow %{
def __info():
	return []
%}


%shadow %{
__api_version__ = WGL__init___.__api_version__
__author__ = WGL__init___.__author__
__date__ = WGL__init___.__date__
__doc__ = WGL__init___.__doc__
__version__ = WGL__init___.__version__
%}