DGL

OpenGL context & framebuffer configuration types.

License
Boost License 1.0.
Authors
Denis Shelomovskij

struct  Version;

OpenGL API version.


ubyte  major;

Major version part.


ubyte  minor;

Minor version part.


inout pure nothrow @safe this(in ubyte major, in ubyte minor);

Constructor taking a major and a minor version parts.

Preconditions:
major.minor is a valid OpenGL version.

static pure nothrow @safe bool  isValid(in ubyte major, in ubyte minor);

Returns whether major.minor is a valid OpenGL version.

Valid versions are 1.x up to 1.5, 2.0, 2.1, 3.x up to 3.3. For now all versions starting from 4.0 are considered valid.


const pure nothrow @property @safe bool  valid();

Returns whether this object represents a valid API version.

See Version.isValid.


const pure nothrow @property @safe bool  hasProfile();

Returns whether this API version has a profile.

Versions starting from 3.2 has a profile.


const pure nothrow @property @safe bool  canBeForwardCompatible();

Returns whether this API version can be forward compatible.

Versions starting from 3.0 can be forward compatible.


const pure nothrow @safe int  opCmp(in Version rhs);

Ordering comparison for two versions.


const pure @safe string  toString(in char[] fmt = "%d.%d");

Convert version to string using specified format.


enum  Compatibility: int;

OpenGL context compatibility requirements.

See Core And Compatibility in Contexts in OpenGL wiki.

Note:
This is not a flag enum so there is no way to create a forward compatible compatibility profile. The reasons for this decision are:
  • it has no sense as compatibility profile doesn't deprecate anything;
  • some drivers fail to create forward compatible compatibility profile.

 no

No compatibility requirements.

When used for versions starting from 3.2 a core profile is required.

Also this option should be used for creating 1.x and 2.x contexts which has no explicit compatibility options and all are backward compatible.


Backward compatible context.

When used for version 3.1 a GL_ARB_compatibility extension is required. For later versions a compatibility profile is required.

Can be used starting from version 3.1 as all previous versions are backward compatible.


Forward compatible context.

Any deprecated features are unavailable in such context. See Forward compatibility in OpenGL wiki.

When used for versions starting from 3.2 a core profile is required.

Can be used starting from version 3.0 as this version introduced deprecation concept.

Warning:
OpenGL wiki states one should hardly ever use forward compatible context except for version 3.0 as 3.1 removed most of the stuff.

struct  ContextConfig;

OpenGL context configuration description.


Version  version_;

Context version.

See Version.


Compatibility  compatibility;

Context compatibility requirements.

See Compatibility.


bool  debug_;

Whether context is a debug context.

See Debug Output in OpenGL wiki.


const pure nothrow @property @safe bool  valid();

Returns whether this object represents a valid context configuration.


static @property @trusted Version  currentVersion();

Returns active thread context version.


static @property @trusted ContextConfig  current();

Returns active thread context configuration.

Note:
Compatibility profile is expected to not be forward compatible. An Exception will be throw if it is.

static nothrow @trusted bool  extensionSupported(in char[] nameString);

Returns whether active thread context support the extension.


Framebuffer configuration.


struct  ColorBits;

Color bits.


ubyte  total;

Total color bits per pixel.


ubyte  red;
ubyte  green;
ubyte  blue;
ubyte  alpha;

Red, green, blue, and alpha bits per pixel.


ColorBits  colorBits;

Color buffer bits.


ubyte  depthBits;

Depth bits.


ubyte  stencilBits;

Stencil bits.


ColorBits  accumBits;

Accumulation buffer bits.


ubyte  auxBuffers;

Auxiliary buffers count.


bool  accelerated;

Whether this framebuffer format is hardware accelerated.


Whether this framebuffer format is double buffered.


bool  stereo;

Whether this framebuffer format is stereo, i.e. color buffer has left/right pairs.


ubyte  coverageSamples;
ubyte  colorSamples;

Multisample buffer coverage & color samples count.

Non-zero values indicate multisampling is available for this framebuffer format. If no multisampling is available, both values are zero.

coverageSamples >= colorSamples is always true.


bool  sRGB;

Whether this framebuffer format is sRGB capable.


Structure for framebuffer configuration selection.


bool delegate(in FramebufferConfig)  usable;

Returns whether given framebuffer configuration is usable.

If null, every framebuffer configuration is considered usable.


int delegate(in FramebufferConfig)[]  weights;

Every delegate in this array returns weight of a given framebuffer configuration.

A configuration with the minimum weight is preffered.

If  weights contains multiple delegates, they are applied sequentially starting from the first one until there is the only one preffered configuration or there is no more delegates.

If  weights is empty or if after applying all delegates there are multiple preffered configurations, any one is selected.


const pure nothrow @property @safe bool  valid();

Returns whether this object represents a valid structure for framebuffer configuration selection..


Information for OpenGL context creation & framebuffer configuration selection.


ContextConfig  context;

Requested context configuration.

See ContextConfig.


FramebufferSelection  framebuffer;

Requested framebuffer configuration selection.

See FramebufferSelection.


const pure nothrow @property @safe bool  valid();

Returns whether this object represents a valid information for context creation & framebuffer configuration selection.