Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-06-02 08:58:15

0001 ////////////////////////////////////////////////////////////
0002 //
0003 // SFML - Simple and Fast Multimedia Library
0004 // Copyright (C) 2007-2023 Laurent Gomila (laurent@sfml-dev.org)
0005 //
0006 // This software is provided 'as-is', without any express or implied warranty.
0007 // In no event will the authors be held liable for any damages arising from the use of this software.
0008 //
0009 // Permission is granted to anyone to use this software for any purpose,
0010 // including commercial applications, and to alter it and redistribute it freely,
0011 // subject to the following restrictions:
0012 //
0013 // 1. The origin of this software must not be misrepresented;
0014 //    you must not claim that you wrote the original software.
0015 //    If you use this software in a product, an acknowledgment
0016 //    in the product documentation would be appreciated but is not required.
0017 //
0018 // 2. Altered source versions must be plainly marked as such,
0019 //    and must not be misrepresented as being the original software.
0020 //
0021 // 3. This notice may not be removed or altered from any source distribution.
0022 //
0023 ////////////////////////////////////////////////////////////
0024 
0025 #ifndef SFML_CONTEXTSETTINGS_HPP
0026 #define SFML_CONTEXTSETTINGS_HPP
0027 
0028 #include <SFML/Config.hpp>
0029 
0030 namespace sf
0031 {
0032 ////////////////////////////////////////////////////////////
0033 /// \brief Structure defining the settings of the OpenGL
0034 ///        context attached to a window
0035 ///
0036 ////////////////////////////////////////////////////////////
0037 struct ContextSettings
0038 {
0039     ////////////////////////////////////////////////////////////
0040     /// \brief Enumeration of the context attribute flags
0041     ///
0042     ////////////////////////////////////////////////////////////
0043     enum Attribute
0044     {
0045         Default = 0,      //!< Non-debug, compatibility context (this and the core attribute are mutually exclusive)
0046         Core    = 1 << 0, //!< Core attribute
0047         Debug   = 1 << 2  //!< Debug attribute
0048     };
0049 
0050     ////////////////////////////////////////////////////////////
0051     /// \brief Default constructor
0052     ///
0053     /// \param depth        Depth buffer bits
0054     /// \param stencil      Stencil buffer bits
0055     /// \param antialiasing Antialiasing level
0056     /// \param major        Major number of the context version
0057     /// \param minor        Minor number of the context version
0058     /// \param attributes   Attribute flags of the context
0059     /// \param sRgb         sRGB capable framebuffer
0060     ///
0061     ////////////////////////////////////////////////////////////
0062     explicit ContextSettings(unsigned int depth = 0, unsigned int stencil = 0, unsigned int antialiasing = 0, unsigned int major = 1, unsigned int minor = 1, unsigned int attributes = Default, bool sRgb = false) :
0063     depthBits        (depth),
0064     stencilBits      (stencil),
0065     antialiasingLevel(antialiasing),
0066     majorVersion     (major),
0067     minorVersion     (minor),
0068     attributeFlags   (attributes),
0069     sRgbCapable      (sRgb)
0070     {
0071     }
0072 
0073     ////////////////////////////////////////////////////////////
0074     // Member data
0075     ////////////////////////////////////////////////////////////
0076     unsigned int depthBits;         //!< Bits of the depth buffer
0077     unsigned int stencilBits;       //!< Bits of the stencil buffer
0078     unsigned int antialiasingLevel; //!< Level of antialiasing
0079     unsigned int majorVersion;      //!< Major number of the context version to create
0080     unsigned int minorVersion;      //!< Minor number of the context version to create
0081     Uint32       attributeFlags;    //!< The attribute flags to create the context with
0082     bool         sRgbCapable;       //!< Whether the context framebuffer is sRGB capable
0083 };
0084 
0085 } // namespace sf
0086 
0087 
0088 #endif // SFML_CONTEXTSETTINGS_HPP
0089 
0090 
0091 ////////////////////////////////////////////////////////////
0092 /// \class sf::ContextSettings
0093 /// \ingroup window
0094 ///
0095 /// ContextSettings allows to define several advanced settings
0096 /// of the OpenGL context attached to a window. All these
0097 /// settings with the exception of the compatibility flag
0098 /// and anti-aliasing level have no impact on the regular
0099 /// SFML rendering (graphics module), so you may need to use
0100 /// this structure only if you're using SFML as a windowing
0101 /// system for custom OpenGL rendering.
0102 ///
0103 /// The depthBits and stencilBits members define the number
0104 /// of bits per pixel requested for the (respectively) depth
0105 /// and stencil buffers.
0106 ///
0107 /// antialiasingLevel represents the requested number of
0108 /// multisampling levels for anti-aliasing.
0109 ///
0110 /// majorVersion and minorVersion define the version of the
0111 /// OpenGL context that you want. Only versions greater or
0112 /// equal to 3.0 are relevant; versions lesser than 3.0 are
0113 /// all handled the same way (i.e. you can use any version
0114 /// < 3.0 if you don't want an OpenGL 3 context).
0115 ///
0116 /// When requesting a context with a version greater or equal
0117 /// to 3.2, you have the option of specifying whether the
0118 /// context should follow the core or compatibility profile
0119 /// of all newer (>= 3.2) OpenGL specifications. For versions
0120 /// 3.0 and 3.1 there is only the core profile. By default
0121 /// a compatibility context is created. You only need to specify
0122 /// the core flag if you want a core profile context to use with
0123 /// your own OpenGL rendering.
0124 /// <b>Warning: The graphics module will not function if you
0125 /// request a core profile context. Make sure the attributes are
0126 /// set to Default if you want to use the graphics module.</b>
0127 ///
0128 /// Setting the debug attribute flag will request a context with
0129 /// additional debugging features enabled. Depending on the
0130 /// system, this might be required for advanced OpenGL debugging.
0131 /// OpenGL debugging is disabled by default.
0132 ///
0133 /// <b>Special Note for OS X:</b>
0134 /// Apple only supports choosing between either a legacy context
0135 /// (OpenGL 2.1) or a core context (OpenGL version depends on the
0136 /// operating system version but is at least 3.2). Compatibility
0137 /// contexts are not supported. Further information is available on the
0138 /// <a href="https://developer.apple.com/opengl/capabilities/index.html">
0139 /// OpenGL Capabilities Tables</a> page. OS X also currently does
0140 /// not support debug contexts.
0141 ///
0142 /// Please note that these values are only a hint.
0143 /// No failure will be reported if one or more of these values
0144 /// are not supported by the system; instead, SFML will try to
0145 /// find the closest valid match. You can then retrieve the
0146 /// settings that the window actually used to create its context,
0147 /// with Window::getSettings().
0148 ///
0149 ////////////////////////////////////////////////////////////