1 /*
2  * DSFML - The Simple and Fast Multimedia Library for D
3  *
4  * Copyright (c) 2013 - 2017 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 /**
26  * $(U ContextSettings) allows to define several advanced settings of the OpenGL
27  * context attached to a window.
28  *
29  * All these settings have no impact on the regular DSFML rendering
30  * (graphics module) – except the anti-aliasing level, so you may need to use
31  * this structure only if you're using SFML as a windowing system for custom
32  * OpenGL rendering.
33  *
34  * The `depthBits` and `stencilBits` members define the number of bits per pixel
35  * requested for the (respectively) depth and stencil buffers.
36  *
37  * antialiasingLevel represents the requested number of multisampling levels for
38  * anti-aliasing.
39  *
40  * majorVersion and minorVersion define the version of the OpenGL context that
41  * you want. Only versions greater or equal to 3.0 are relevant; versions lesser
42  * than 3.0 are all handled the same way (i.e. you can use any version < 3.0 if
43  * you don't want an OpenGL 3 context).
44  *
45  * When requesting a context with a version greater or equal to 3.2, you have
46  * the option of specifying whether the context should follow the core or
47  * compatibility profile of all newer (>= 3.2) OpenGL specifications. For
48  * versions 3.0 and 3.1 there is only the core profile. By default a
49  * compatibility context is created. You only need to specify the core flag if
50  * you want a core profile context to use with your own OpenGL rendering.
51  * Warning: The graphics module will not function if you request a core
52  * profile context. Make sure the attributes are set to Default if you want to
53  * use the graphics module.
54  *
55  * Linking with a debug SFML binary will cause a context to be requested with
56  * additional debugging features enabled. Depending on the system, this might be
57  * required for advanced OpenGL debugging. OpenGL debugging is disabled by
58  * default.
59  *
60  * $(B Special Note for OS X:)
61  * Apple only supports choosing between either a legacy context (OpenGL 2.1) or
62  * a core context (OpenGL version depends on the operating system version but is
63  * at least 3.2). Compatibility contexts are not supported. Further information
64  * is available on the $(LINK2
65  * https://developer.apple.com/opengl/capabilities/index.html,
66  * OpenGL Capabilities Tables) page. OS X also currently does not support debug
67  * contexts.
68  *
69  * Please note that these values are only a hint. No failure will be reported if
70  * one or more of these values are not supported by the system; instead, SFML
71  * will try to find the closest valid match. You can then retrieve the settings
72  * that the window actually used to create its context, with
73  * `Window.getSettings()`.
74  */
75 module dsfml.window.contextsettings;
76 
77 /**
78  * Structure defining the settings of the OpenGL context attached to a window.
79  */
80 struct ContextSettings
81 {
82     /// Bits of the depth buffer.
83     uint depthBits = 0;
84     /// Bits of the stencil buffer.
85     uint stencilBits = 0;
86     /// Level of antialiasing.
87     uint antialiasingLevel = 0;
88     /// Level of antialiasing.
89     uint majorVersion = 2;
90     /// Minor number of the context version to create.
91     uint minorVersion = 0;
92 }