Version: 3.1.4
wxGLContextAttrs Class Reference

#include <wx/glcanvas.h>

+ Inheritance diagram for wxGLContextAttrs:

Detailed Description

This class is used for setting context attributes.

Since OpenGL version 3.0 the ARB adds attributes time to time to the rendering context functionality. wxWidgets implements attributes up to OGL 4.5, but you can set new attributes by using AddAttribute() and AddAttribBits() functions inherited from the base wxGLAttribsBase class.

Attributes can be chained. For example:

Notice that EndList() must be used as the last attribute. Not adding it will likely result in nothing displayed at all.

Since
3.1.0

Library:  wxGL
Category:  OpenGL
See also
wxGLCanvas, wxGLContext, wxGLAttribsBase, wxGLAttributes

Public Member Functions

wxGLContextAttrsCoreProfile ()
 Request an OpenGL core profile for the context. More...
 
wxGLContextAttrsMajorVersion (int val)
 Request specific OpenGL core major version number (>= 3). More...
 
wxGLContextAttrsMinorVersion (int val)
 Request specific OpenGL core minor version number. More...
 
wxGLContextAttrsOGLVersion (int vmayor, int vminor)
 An easy way of requesting an OpenGL version. More...
 
wxGLContextAttrsCompatibilityProfile ()
 Request a type of context with all OpenGL features from version 1.0 to the newest available by the GPU driver. More...
 
wxGLContextAttrsForwardCompatible ()
 Request a forward-compatible context. More...
 
wxGLContextAttrsES2 ()
 Request an ES or ES2 ("Embedded Subsystem") context. More...
 
wxGLContextAttrsDebugCtx ()
 Request debugging functionality. More...
 
wxGLContextAttrsRobust ()
 Request robustness, or how OpenGL handles out-of-bounds buffer object accesses and graphics reset notification behaviours. More...
 
wxGLContextAttrsNoResetNotify ()
 With robustness enabled, never deliver notification of reset events. More...
 
wxGLContextAttrsLoseOnReset ()
 With robustness enabled, if graphics reset happens, all context state is lost. More...
 
wxGLContextAttrsResetIsolation ()
 Request OpenGL to protect other applications or shared contexts from reset side-effects. More...
 
wxGLContextAttrsReleaseFlush (int val=1)
 Request OpenGL to avoid or not flushing pending commands when the context is made no longer current (released). More...
 
wxGLContextAttrsPlatformDefaults ()
 Set platform specific defaults. More...
 
void EndList ()
 The set of attributes must end with this one; otherwise, the GPU may display nothing at all. More...
 
- Public Member Functions inherited from wxGLAttribsBase
 wxGLAttribsBase ()
 Constructor. More...
 
void AddAttribute (int attribute)
 Adds an integer value to the list of attributes. More...
 
void AddAttribBits (int searchVal, int combineVal)
 Combine (bitwise OR) a given value with the existing one, if any. More...
 
void SetNeedsARB (bool needsARB=true)
 Sets the necessity of using special ARB-functions (e.g. More...
 
void Reset ()
 Delete contents and sets ARB-flag to false. More...
 
const int * GetGLAttrs () const
 Returns a pointer to the internal list of attributes. More...
 
int GetSize ()
 Returns the size of the internal list of attributes. More...
 
bool NeedsARB () const
 Returns the current value of the ARB-flag. More...
 

Member Function Documentation

wxGLContextAttrs& wxGLContextAttrs::CompatibilityProfile ( )

Request a type of context with all OpenGL features from version 1.0 to the newest available by the GPU driver.

In this mode the GPU may be some slower than it would be without this compatibility attribute.

wxGLContextAttrs& wxGLContextAttrs::CoreProfile ( )

Request an OpenGL core profile for the context.

If the requested OpenGL version is less than 3.2, this attribute is ignored and the functionality of the context is determined solely by the requested version.

wxGLContextAttrs& wxGLContextAttrs::DebugCtx ( )

Request debugging functionality.

This tells OpenGL to prepare a set where some logs are enabled and also allows OGL to send debug messages through a callback function.

It has no effect under macOS.

void wxGLContextAttrs::EndList ( )

The set of attributes must end with this one; otherwise, the GPU may display nothing at all.

wxGLContextAttrs& wxGLContextAttrs::ES2 ( )

Request an ES or ES2 ("Embedded Subsystem") context.

These are special subsets of OpenGL, lacking some features of the full specification. Used mainly in embedded devices such as mobile phones.

It has no effect under macOS.

wxGLContextAttrs& wxGLContextAttrs::ForwardCompatible ( )

Request a forward-compatible context.

Forward-compatible contexts are defined only for OpenGL versions 3.0 and later. They must not support functionality marked as deprecated or removed by the requested version of the OpenGL API.

It has no effect under macOS.

wxGLContextAttrs& wxGLContextAttrs::LoseOnReset ( )

With robustness enabled, if graphics reset happens, all context state is lost.

It has no effect under macOS.

wxGLContextAttrs& wxGLContextAttrs::MajorVersion ( int  val)

Request specific OpenGL core major version number (>= 3).

Parameters
valThe major version number requested.

It has no effect under macOS where specifying CoreProfile() will result in using OpenGL version at least 3.2.

wxGLContextAttrs& wxGLContextAttrs::MinorVersion ( int  val)

Request specific OpenGL core minor version number.

Parameters
valThe minor version number requested, e.g. 2 if OpenGL 3.2 is requested.

It has no effect under macOS where specifying CoreProfile() will result in using OpenGL version at least 3.2.

wxGLContextAttrs& wxGLContextAttrs::NoResetNotify ( )

With robustness enabled, never deliver notification of reset events.

It has no effect under macOS.

wxGLContextAttrs& wxGLContextAttrs::OGLVersion ( int  vmayor,
int  vminor 
)

An easy way of requesting an OpenGL version.

Parameters
vmayorThe major version number requested, e.g. 4 if OpenGL 4.5 is requested.
vminorThe minor version number requested, e.g. 5 if OpenGL 4.5 is requested.

It has no effect under macOS where specifying CoreProfile() will result in using OpenGL version at least 3.2.

wxGLContextAttrs& wxGLContextAttrs::PlatformDefaults ( )

Set platform specific defaults.

Currently only Unix defaults are implemented: use X11 direct rendering and use X11 RGBA type.

wxGLContextAttrs& wxGLContextAttrs::ReleaseFlush ( int  val = 1)

Request OpenGL to avoid or not flushing pending commands when the context is made no longer current (released).

If you don't specify this attribute, the GPU driver default is 'flushing'.

Parameters
val0 for not flushing, 1 (wxWidgets default) for flushing pending commands.

It has no effect under macOS.

wxGLContextAttrs& wxGLContextAttrs::ResetIsolation ( )

Request OpenGL to protect other applications or shared contexts from reset side-effects.

It has no effect under macOS.

wxGLContextAttrs& wxGLContextAttrs::Robust ( )

Request robustness, or how OpenGL handles out-of-bounds buffer object accesses and graphics reset notification behaviours.

It has no effect under macOS.