-
Notifications
You must be signed in to change notification settings - Fork 72
/
Copy pathwgl.ahk
257 lines (219 loc) · 7.08 KB
/
wgl.ahk
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
; AutoHotkey header file for OpenGL-Win32.
; wgl.ahk last updated Date: 2011-03-08 (Tuesday, 08 Mar 2011)
; Written by: Bentschi
;=============================================================
GLptr := (A_PtrSize) ? "ptr" : "uint" ;AutoHotkey definition
GLastr := (A_IsUnicode) ? "astr" : "str" ;AutoHotkey definition
wglCopyContext(hglrcSrc, hglrcDst, mask)
{
global
return DllCall("opengl32\" A_ThisFunc, GLptr, hglrcSrc, GLptr, hglrcDst, "uint", mask, "uint")
}
wglCreateContext(hdc)
{
global
return DllCall("opengl32\" A_ThisFunc, GLptr, hDC, GLptr)
}
wglCreateLayerContext(hdc, iLayerPlane)
{
global
return DllCall("opengl32\" A_ThisFunc, GLptr, hDC, "int", iLayerPlane, GLptr)
}
wglDeleteContext(hglrc)
{
global
return DllCall("opengl32\" A_ThisFunc, GLptr, hglrc, "uint")
}
wglGetCurrentContext()
{
global
return DllCall("opengl32\" A_ThisFunc, GLptr)
}
wglGetCurrentDC()
{
global
return DllCall("opengl32\" A_ThisFunc, GLptr)
}
wglGetProcAddress(lpszProc)
{
global
return DllCall("opengl32\" A_ThisFunc, GLastr, lpszProc, GLptr)
}
wglMakeCurrent(hdc, hglrc)
{
global
return DllCall("opengl32\" A_ThisFunc, GLptr, hdc, GLptr, hglrc, "uint")
}
wglShareLists(hglrc1, hglrc2)
{
global
return DllCall("opengl32\" A_ThisFunc, GLptr, hglrc1, GLptr, hglrc2, "uint")
}
wglUseFontBitmapsA(hdc, first, count, listBase)
{
global
return DllCall("opengl32\" A_ThisFunc, GLptr, hdc, "uint", first, "uint", count, "uint", listBase, "uint")
}
wglUseFontBitmapsW(hdc, first, count, listBase)
{
global
return DllCall("opengl32\" A_ThisFunc, GLptr, hdc, "uint", first, "uint", count, "uint", listBase, "uint")
}
wglUseFontBitmaps(hdc, first, count, listBase)
{
if (A_IsUnicode)
return wglUseFontBitmapsW(hdc, first, count, listBase)
else
return wglUseFontBitmapsA(hdc, first, count, listBase)
}
SwapBuffers(hdc)
{
global
return DllCall("gdi32\" A_ThisFunc, GLptr, hdc, "uint")
}
WGL_FONT_LINES := 0
WGL_FONT_POLYGONS := 1
wglUseFontOutlinesA(hdc, first, count, listBase, deviation, extrusion, format, lpgmf)
{
global
return DllCall("opengl32\" A_ThisFunc, GLptr, hdc, "uint", first, "uint", count, "uint", listBase, "float", deviation, "float", extrusion, "int", format, GLptr, lpgmf, "uint")
}
wglUseFontOutlinesW(hdc, first, count, listBase, deviation, extrusion, format, lpgmf)
{
global
return DllCall("opengl32\" A_ThisFunc, GLptr, hdc, "uint", first, "uint", count, "uint", listBase, "float", deviation, "float", extrusion, "int", format, GLptr, lpgmf, "uint")
}
wglUseFontOutlines(hdc, first, count, listBase, deviation, extrusion, format, lpgmf)
{
if (A_IsUnicode)
return wglUseFontOutlinesW(hdc, first, count, listBase, deviation, extrusion, format, lpgmf)
else
return wglUseFontOutlinesA(hdc, first, count, listBase, deviation, extrusion, format, lpgmf)
}
LPD_DOUBLEBUFFER := 0x00000001
LPD_STEREO := 0x00000002
LPD_SUPPORT_GDI := 0x00000010
LPD_SUPPORT_OPENGL := 0x00000020
LPD_SHARE_DEPTH := 0x00000040
LPD_SHARE_STENCIL := 0x00000080
LPD_SHARE_ACCUM := 0x00000100
LPD_SWAP_EXCHANGE := 0x00000200
LPD_SWAP_COPY := 0x00000400
LPD_TRANSPARENT := 0x00001000
LPD_TYPE_RGBA := 0
LPD_TYPE_COLORINDEX := 1
;wglSwapLayerBuffers flags
WGL_SWAP_MAIN_PLANE := 0x00000001
WGL_SWAP_OVERLAY1 := 0x00000002
WGL_SWAP_OVERLAY2 := 0x00000004
WGL_SWAP_OVERLAY3 := 0x00000008
WGL_SWAP_OVERLAY4 := 0x00000010
WGL_SWAP_OVERLAY5 := 0x00000020
WGL_SWAP_OVERLAY6 := 0x00000040
WGL_SWAP_OVERLAY7 := 0x00000080
WGL_SWAP_OVERLAY8 := 0x00000100
WGL_SWAP_OVERLAY9 := 0x00000200
WGL_SWAP_OVERLAY10 := 0x00000400
WGL_SWAP_OVERLAY11 := 0x00000800
WGL_SWAP_OVERLAY12 := 0x00001000
WGL_SWAP_OVERLAY13 := 0x00002000
WGL_SWAP_OVERLAY14 := 0x00004000
WGL_SWAP_OVERLAY15 := 0x00008000
WGL_SWAP_UNDERLAY1 := 0x00010000
WGL_SWAP_UNDERLAY2 := 0x00020000
WGL_SWAP_UNDERLAY3 := 0x00040000
WGL_SWAP_UNDERLAY4 := 0x00080000
WGL_SWAP_UNDERLAY5 := 0x00100000
WGL_SWAP_UNDERLAY6 := 0x00200000
WGL_SWAP_UNDERLAY7 := 0x00400000
WGL_SWAP_UNDERLAY8 := 0x00800000
WGL_SWAP_UNDERLAY9 := 0x01000000
WGL_SWAP_UNDERLAY10 := 0x02000000
WGL_SWAP_UNDERLAY11 := 0x04000000
WGL_SWAP_UNDERLAY12 := 0x08000000
WGL_SWAP_UNDERLAY13 := 0x10000000
WGL_SWAP_UNDERLAY14 := 0x20000000
WGL_SWAP_UNDERLAY15 := 0x40000000
wglDescribeLayerPlane(hdc, iPixelFormat, iLayerPlane, nBytes, plpd)
{
global
return DllCall("opengl32\" A_ThisFunc, GLptr, hdc, "int", iPixelFormat, "int", iLayerPlane, "uint", nBytes, GLptr, lppd, "uint")
}
wglSetLayerPaletteEntries(hdc, iLayerPlane, iStart, cEntries, pcr)
{
global
return DllCall("opengl32\" A_ThisFunc, GLptr, hdc, "int", iLayerPlane, "int", iStart, "int", cEntries, GLptr, pcr, "int")
}
wglGetLayerPaletteEntries(hdc, iLayerPlane, iStart, cEntries, pcr)
{
global
return DllCall("opengl32\" A_ThisFunc, GLptr, hdc, "int", iLayerPlane, "int", iStart, "int", cEntries, GLptr, pcr, "int")
}
wglRealizeLayerPalette(hdc, iLayerPlane, bRealize)
{
global
return DllCall("opengl32\" A_ThisFunc, GLptr, hdc, "int", iLayerPlane, "uint", bRealize, "uint")
}
wglSwapLayerBuffers(hdc, fuPlanes)
{
global
return DllCall("opengl32\" A_ThisFunc, GLptr, hdc, "uint", fuPlanes, "uint")
}
WGL_SWAPMULTIPLE_MAX := 16
wglSwapMultibleBuffers(n, pwglswap)
{
global
return DllCall("opengl32\" A_ThisFunc, "uint", n, GLptr, pwglswap, "uint")
}
PFD_TYPE_RGBA := 0
PFD_TYPE_COLORINDEX := 1
;layer types
PFD_MAIN_PLANE := 0
PFD_OVERLAY_PLANE := 1
PFD_UNDERLAY_PLANE := (-1)
;PIXELFORMATDESCRIPTOR flags
PFD_DOUBLEBUFFER := 0x00000001
PFD_STEREO := 0x00000002
PFD_DRAW_TO_WINDOW := 0x00000004
PFD_DRAW_TO_BITMAP := 0x00000008
PFD_SUPPORT_GDI := 0x00000010
PFD_SUPPORT_OPENGL := 0x00000020
PFD_GENERIC_FORMAT := 0x00000040
PFD_NEED_PALETTE := 0x00000080
PFD_NEED_SYSTEM_PALETTE := 0x00000100
PFD_SWAP_EXCHANGE := 0x00000200
PFD_SWAP_COPY := 0x00000400
PFD_SWAP_LAYER_BUFFERS := 0x00000800
PFD_GENERIC_ACCELERATED := 0x00001000
PFD_SUPPORT_DIRECTDRAW := 0x00002000
PFD_DIRECT3D_ACCELERATED := 0x00004000
PFD_SUPPORT_COMPOSITION := 0x00008000
;PIXELFORMATDESCRIPTOR flags for use in ChoosePixelFormat only
PFD_DEPTH_DONTCARE := 0x20000000
PFD_DOUBLEBUFFER_DONTCARE := 0x40000000
PFD_STEREO_DONTCARE := 0x80000000
ChoosePixelFormat(hdc, ppfd)
{
global
return DllCall("gdi32\" A_ThisFunc, GLptr, hdc, GLptr, ppfd, "int")
}
DescribePixelFormat(hdc, iPixelFormat, nBytes, ppfd)
{
global
return DllCall("gdi32\" A_ThisFunc, GLptr, hdc, "int", iPixelFormat, "uint", nBytes, GLptr, ppfd, "uint")
}
GetEnhMetaFilePixelFormat(hemf, cbBuffer, ppfd)
{
global
return DllCall("gdi32\" A_ThisFunc, GLptr, hemf, "uint", cbBuffer, GLptr, ppfd, "uint")
}
GetPixelFormat(hdc)
{
global
return DllCall("gdi32\" A_ThisFunc, GLptr, hdc, "int")
}
SetPixelFormat(hdc, iPixelFormat, ppfd)
{
global
return DllCall("gdi32\" A_ThisFunc, GLptr, hdc, "int", iPixelFormat, GLptr, ppfd, "uint")
}