]> gitweb.factorcode.org Git - factor.git/blob - basis/windows/opengl32/opengl32.factor
use radix literals
[factor.git] / basis / windows / opengl32 / opengl32.factor
1 ! Copyright (C) 2005, 2006 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: alien alien.c-types alien.syntax parser namespaces kernel
4 math math.bitwise windows.types init assocs splitting
5 sequences libc opengl.gl opengl.gl.extensions opengl.gl.windows ;
6 IN: windows.opengl32
7
8 CONSTANT: LPD_TYPE_RGBA        0
9 CONSTANT: LPD_TYPE_COLORINDEX  1
10
11 ! wglSwapLayerBuffers flags
12 CONSTANT: WGL_SWAP_MAIN_PLANE     0x00000001
13 CONSTANT: WGL_SWAP_OVERLAY1       0x00000002
14 CONSTANT: WGL_SWAP_OVERLAY2       0x00000004
15 CONSTANT: WGL_SWAP_OVERLAY3       0x00000008
16 CONSTANT: WGL_SWAP_OVERLAY4       0x00000010
17 CONSTANT: WGL_SWAP_OVERLAY5       0x00000020
18 CONSTANT: WGL_SWAP_OVERLAY6       0x00000040
19 CONSTANT: WGL_SWAP_OVERLAY7       0x00000080
20 CONSTANT: WGL_SWAP_OVERLAY8       0x00000100
21 CONSTANT: WGL_SWAP_OVERLAY9       0x00000200
22 CONSTANT: WGL_SWAP_OVERLAY10      0x00000400
23 CONSTANT: WGL_SWAP_OVERLAY11      0x00000800
24 CONSTANT: WGL_SWAP_OVERLAY12      0x00001000
25 CONSTANT: WGL_SWAP_OVERLAY13      0x00002000
26 CONSTANT: WGL_SWAP_OVERLAY14      0x00004000
27 CONSTANT: WGL_SWAP_OVERLAY15      0x00008000
28 CONSTANT: WGL_SWAP_UNDERLAY1      0x00010000
29 CONSTANT: WGL_SWAP_UNDERLAY2      0x00020000
30 CONSTANT: WGL_SWAP_UNDERLAY3      0x00040000
31 CONSTANT: WGL_SWAP_UNDERLAY4      0x00080000
32 CONSTANT: WGL_SWAP_UNDERLAY5      0x00100000
33 CONSTANT: WGL_SWAP_UNDERLAY6      0x00200000
34 CONSTANT: WGL_SWAP_UNDERLAY7      0x00400000
35 CONSTANT: WGL_SWAP_UNDERLAY8      0x00800000
36 CONSTANT: WGL_SWAP_UNDERLAY9      0x01000000
37 CONSTANT: WGL_SWAP_UNDERLAY10     0x02000000
38 CONSTANT: WGL_SWAP_UNDERLAY11     0x04000000
39 CONSTANT: WGL_SWAP_UNDERLAY12     0x08000000
40 CONSTANT: WGL_SWAP_UNDERLAY13     0x10000000
41 CONSTANT: WGL_SWAP_UNDERLAY14     0x20000000
42 CONSTANT: WGL_SWAP_UNDERLAY15     0x40000000
43
44
45 LIBRARY: gl
46
47
48 ! FUNCTION: int ReleaseDC ( HWND hWnd, HDC hDC ) ;
49 ! FUNCTION: HDC ResetDC ( HDC hdc, DEVMODE* lpInitData ) ;
50 ! FUNCTION: BOOL RestoreDC ( HDC hdc, int nSavedDC ) ;
51 ! FUNCTION: int SaveDC( HDC hDC ) ;
52 ! FUNCTION: HGDIOBJ SelectObject ( HDC hDC, HGDIOBJ hgdiobj ) ;
53
54 FUNCTION: HGLRC wglCreateContext ( HDC hDC ) ;
55 FUNCTION: BOOL wglDeleteContext ( HGLRC hRC ) ;
56 FUNCTION: BOOL wglMakeCurrent ( HDC hDC, HGLRC hglrc ) ;
57
58 ! WGL_ARB_extensions_string extension
59
60 GL-FUNCTION: c-string wglGetExtensionsStringARB { } ( HDC hDC ) ;
61
62 ! WGL_ARB_pixel_format extension
63
64 CONSTANT: WGL_NUMBER_PIXEL_FORMATS_ARB    0x2000
65 CONSTANT: WGL_DRAW_TO_WINDOW_ARB          0x2001
66 CONSTANT: WGL_DRAW_TO_BITMAP_ARB          0x2002
67 CONSTANT: WGL_ACCELERATION_ARB            0x2003
68 CONSTANT: WGL_NEED_PALETTE_ARB            0x2004
69 CONSTANT: WGL_NEED_SYSTEM_PALETTE_ARB     0x2005
70 CONSTANT: WGL_SWAP_LAYER_BUFFERS_ARB      0x2006
71 CONSTANT: WGL_SWAP_METHOD_ARB             0x2007
72 CONSTANT: WGL_NUMBER_OVERLAYS_ARB         0x2008
73 CONSTANT: WGL_NUMBER_UNDERLAYS_ARB        0x2009
74 CONSTANT: WGL_TRANSPARENT_ARB             0x200A
75 CONSTANT: WGL_TRANSPARENT_RED_VALUE_ARB   0x2037
76 CONSTANT: WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038
77 CONSTANT: WGL_TRANSPARENT_BLUE_VALUE_ARB  0x2039
78 CONSTANT: WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A
79 CONSTANT: WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B
80 CONSTANT: WGL_SHARE_DEPTH_ARB             0x200C
81 CONSTANT: WGL_SHARE_STENCIL_ARB           0x200D
82 CONSTANT: WGL_SHARE_ACCUM_ARB             0x200E
83 CONSTANT: WGL_SUPPORT_GDI_ARB             0x200F
84 CONSTANT: WGL_SUPPORT_OPENGL_ARB          0x2010
85 CONSTANT: WGL_DOUBLE_BUFFER_ARB           0x2011
86 CONSTANT: WGL_STEREO_ARB                  0x2012
87 CONSTANT: WGL_PIXEL_TYPE_ARB              0x2013
88 CONSTANT: WGL_COLOR_BITS_ARB              0x2014
89 CONSTANT: WGL_RED_BITS_ARB                0x2015
90 CONSTANT: WGL_RED_SHIFT_ARB               0x2016
91 CONSTANT: WGL_GREEN_BITS_ARB              0x2017
92 CONSTANT: WGL_GREEN_SHIFT_ARB             0x2018
93 CONSTANT: WGL_BLUE_BITS_ARB               0x2019
94 CONSTANT: WGL_BLUE_SHIFT_ARB              0x201A
95 CONSTANT: WGL_ALPHA_BITS_ARB              0x201B
96 CONSTANT: WGL_ALPHA_SHIFT_ARB             0x201C
97 CONSTANT: WGL_ACCUM_BITS_ARB              0x201D
98 CONSTANT: WGL_ACCUM_RED_BITS_ARB          0x201E
99 CONSTANT: WGL_ACCUM_GREEN_BITS_ARB        0x201F
100 CONSTANT: WGL_ACCUM_BLUE_BITS_ARB         0x2020
101 CONSTANT: WGL_ACCUM_ALPHA_BITS_ARB        0x2021
102 CONSTANT: WGL_DEPTH_BITS_ARB              0x2022
103 CONSTANT: WGL_STENCIL_BITS_ARB            0x2023
104 CONSTANT: WGL_AUX_BUFFERS_ARB             0x2024
105
106 CONSTANT: WGL_NO_ACCELERATION_ARB         0x2025
107 CONSTANT: WGL_GENERIC_ACCELERATION_ARB    0x2026
108 CONSTANT: WGL_FULL_ACCELERATION_ARB       0x2027
109
110 CONSTANT: WGL_SWAP_EXCHANGE_ARB           0x2028
111 CONSTANT: WGL_SWAP_COPY_ARB               0x2029
112 CONSTANT: WGL_SWAP_UNDEFINED_ARB          0x202A
113
114 CONSTANT: WGL_TYPE_RGBA_ARB               0x202B
115 CONSTANT: WGL_TYPE_COLORINDEX_ARB         0x202C
116
117 GL-FUNCTION: BOOL wglGetPixelFormatAttribivARB { } (
118         HDC hdc,
119         int iPixelFormat,
120         int iLayerPlane,
121         UINT nAttributes,
122         int* piAttributes,
123         int* piValues
124     ) ;
125
126 GL-FUNCTION: BOOL wglGetPixelFormatAttribfvARB { } (
127         HDC hdc,
128         int iPixelFormat,
129         int iLayerPlane,
130         UINT nAttributes,
131         int* piAttributes,
132         FLOAT* pfValues
133     ) ;
134
135 GL-FUNCTION: BOOL wglChoosePixelFormatARB { } (
136         HDC hdc,
137         int* piAttribIList,
138         FLOAT* pfAttribFList,
139         UINT nMaxFormats,
140         int* piFormats,
141         UINT* nNumFormats
142     ) ;
143
144 ! WGL_ARB_multisample extension
145
146 CONSTANT: WGL_SAMPLE_BUFFERS_ARB 0x2041
147 CONSTANT: WGL_SAMPLES_ARB        0x2042
148
149 ! WGL_ARB_pixel_format_float extension
150
151 CONSTANT: WGL_TYPE_RGBA_FLOAT_ARB 0x21A0
152
153 ! wgl extensions querying
154
155 : has-wglGetExtensionsStringARB? ( -- ? )
156     "wglGetExtensionsStringARB" wglGetProcAddress >boolean ;
157
158 : wgl-extensions ( hdc -- extensions )
159     has-wglGetExtensionsStringARB? [ wglGetExtensionsStringARB " " split ] [ drop { } ] if ;
160
161 : has-wgl-extensions? ( hdc extensions -- ? )
162     swap wgl-extensions [ member? ] curry all? ;
163
164 : has-wgl-pixel-format-extension? ( hdc -- ? )
165     { "WGL_ARB_pixel_format" } has-wgl-extensions? ;