PageRenderTime 7ms CodeModel.GetById 1ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/platform/win/scaffold/opengl.d

http://github.com/wilkie/djehuty
D | 72 lines | 48 code | 10 blank | 14 comment | 0 complexity | 0268a80ad95ecf0aca65394a3934425f MD5 | raw file
 1/*
 2 * opengl.d
 3 *
 4 * This file implements the Scaffold for platform specific OpenGL
 5 * operations in Windows.
 6 *
 7 * Author: Dave Wilkinson
 8 *
 9 */
10
11module scaffold.opengl;
12
13import binding.opengl.gl;
14
15import opengl.window;
16
17import binding.win32.wingdi;
18import binding.win32.windef;
19
20// some extra GDI imports
21
22/* pixel types */
23const auto PFD_TYPE_RGBA			= 0;
24const auto PFD_TYPE_COLORINDEX		= 1;
25
26/* layer types */
27const auto PFD_MAIN_PLANE			= 0;
28const auto PFD_OVERLAY_PLANE		= 1;
29const auto PFD_UNDERLAY_PLANE		= (-1);
30
31/* PIXELFORMATDESCRIPTOR flags */
32const auto PFD_DOUBLEBUFFER				= 0x00000001;
33const auto PFD_STEREO					= 0x00000002;
34const auto PFD_DRAW_TO_WINDOW			= 0x00000004;
35const auto PFD_DRAW_TO_BITMAP			= 0x00000008;
36const auto PFD_SUPPORT_GDI				= 0x00000010;
37const auto PFD_SUPPORT_OPENGL			= 0x00000020;
38const auto PFD_GENERIC_FORMAT			= 0x00000040;
39const auto PFD_NEED_PALETTE				= 0x00000080;
40const auto PFD_NEED_SYSTEM_PALETTE		= 0x00000100;
41const auto PFD_SWAP_EXCHANGE			= 0x00000200;
42const auto PFD_SWAP_COPY				= 0x00000400;
43const auto PFD_SWAP_LAYER_BUFFERS		= 0x00000800;
44const auto PFD_GENERIC_ACCELERATED		= 0x00001000;
45const auto PFD_SUPPORT_DIRECTDRAW		= 0x00002000;
46
47/* PIXELFORMATDESCRIPTOR flags for use in ChoosePixelFormat only */
48const auto PFD_DEPTH_DONTCARE			= 0x20000000;
49const auto PFD_DOUBLEBUFFER_DONTCARE	= 0x40000000;
50const auto PFD_STEREO_DONTCARE			= 0x80000000;
51
52PIXELFORMATDESCRIPTOR pfd =              // pfd Tells Windows How We Want Things To Be
53{
54	PIXELFORMATDESCRIPTOR.sizeof,              // Size Of This Pixel Format Descriptor
55	1,                                          // Version Number
56	PFD_DRAW_TO_WINDOW |                        // Format Must Support Window
57	PFD_SUPPORT_OPENGL |                        // Format Must Support OpenGL
58	PFD_DOUBLEBUFFER,                           // Must Support Double Buffering
59	PFD_TYPE_RGBA,                              // Request An RGBA Format
60	32,                                       // Select Our Color Depth
61	0, 0, 0, 0, 0, 0,                           // Color Bits Ignored
62	0,                                          // No Alpha Buffer
63	0,                                          // Shift Bit Ignored
64	0,                                          // No Accumulation Buffer
65	0, 0, 0, 0,                                 // Accumulation Bits Ignored
66	16,                                         // 16Bit Z-Buffer (Depth Buffer)
67	0,                                          // No Stencil Buffer
68	0,                                          // No Auxiliary Buffer
69	PFD_MAIN_PLANE,                             // Main Drawing Layer
70	0,                                          // Reserved
71	0, 0, 0                                     // Layer Masks Ignored
72};