1 /*
2  * DSFML - The Simple and Fast Multimedia Library for D
3  *
4  * Copyright (c) 2013 - 2018 Jeremy DeHaan (dehaan.jeremiah@gmail.com)
5  *
6  * This software is provided 'as-is', without any express or implied warranty.
7  * In no event will the authors be held liable for any damages arising from the
8  * use of this software.
9  *
10  * Permission is granted to anyone to use this software for any purpose,
11  * including commercial applications, and to alter it and redistribute it
12  * freely, subject to the following restrictions:
13  *
14  * 1. The origin of this software must not be misrepresented; you must not claim
15  * that you wrote the original software. If you use this software in a product,
16  * an acknowledgment in the product documentation would be appreciated but is
17  * not required.
18  *
19  * 2. Altered source versions must be plainly marked as such, and must not be
20  * misrepresented as being the original software.
21  *
22  * 3. This notice may not be removed or altered from any source distribution
23  *
24  *
25  * DSFML is based on SFML (Copyright Laurent Gomila)
26  */
27 
28 /**
29  * $(U ContextSettings) allows to define several advanced settings of the OpenGL
30  * context attached to a window.
31  *
32  * All these settings have no impact on the regular DSFML rendering
33  * (graphics module) – except the anti-aliasing level, so you may need to use
34  * this structure only if you're using SFML as a windowing system for custom
35  * OpenGL rendering.
36  *
37  * The `depthBits` and `stencilBits` members define the number of bits per pixel
38  * requested for the (respectively) depth and stencil buffers.
39  *
40  * antialiasingLevel represents the requested number of multisampling levels for
41  * anti-aliasing.
42  *
43  * majorVersion and minorVersion define the version of the OpenGL context that
44  * you want. Only versions greater or equal to 3.0 are relevant; versions lesser
45  * than 3.0 are all handled the same way (i.e. you can use any version < 3.0 if
46  * you don't want an OpenGL 3 context).
47  *
48  * When requesting a context with a version greater or equal to 3.2, you have
49  * the option of specifying whether the context should follow the core or
50  * compatibility profile of all newer (>= 3.2) OpenGL specifications. For
51  * versions 3.0 and 3.1 there is only the core profile. By default a
52  * compatibility context is created. You only need to specify the core flag if
53  * you want a core profile context to use with your own OpenGL rendering.
54  * Warning: The graphics module will not function if you request a core
55  * profile context. Make sure the attributes are set to Default if you want to
56  * use the graphics module.
57  *
58  * Linking with a debug SFML binary will cause a context to be requested with
59  * additional debugging features enabled. Depending on the system, this might be
60  * required for advanced OpenGL debugging. OpenGL debugging is disabled by
61  * default.
62  *
63  * $(B Special Note for OS X:)
64  * Apple only supports choosing between either a legacy context (OpenGL 2.1) or
65  * a core context (OpenGL version depends on the operating system version but is
66  * at least 3.2). Compatibility contexts are not supported. Further information
67  * is available on the $(LINK2
68  * https://developer.apple.com/opengl/capabilities/index.html,
69  * OpenGL Capabilities Tables) page. OS X also currently does not support debug
70  * contexts.
71  *
72  * Please note that these values are only a hint. No failure will be reported if
73  * one or more of these values are not supported by the system; instead, SFML
74  * will try to find the closest valid match. You can then retrieve the settings
75  * that the window actually used to create its context, with
76  * `Window.getSettings()`.
77  */
78 module dsfml.window.contextsettings;
79 
80 /**
81  * Structure defining the settings of the OpenGL context attached to a window.
82  */
83 struct ContextSettings
84 {
85     /// Bits of the depth buffer.
86     uint depthBits = 0;
87     /// Bits of the stencil buffer.
88     uint stencilBits = 0;
89     /// Level of antialiasing.
90     uint antialiasingLevel = 0;
91     /// Level of antialiasing.
92     uint majorVersion = 2;
93     /// Minor number of the context version to create.
94     uint minorVersion = 0;
95 }