Version: 3.1.2
wxGLAttributes Class Reference

#include <wx/glcanvas.h>

+ Inheritance diagram for wxGLAttributes:

Detailed Description

This class is used for setting display attributes when drawing through OpenGL ("Pixel format" in MSW and OSX parlance, "Configs" in X11).

While framebuffer depth and samplers are still common, attributes like layers overlay or not using true colour are rarely used nowadays.

Attributes can be chained. For example:

wxGLAttributes dispAttrs;
dispAttrs.PlatformDefaults().MinRGBA(8, 8, 8, 8).DoubleBuffer().Depth(32).EndList();

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

Note
Not all of platform-dependant available attributes are implemented in wxWidgets. You can set other attributes by using AddAttribute() and AddAttribBits() functions inherited from the base wxGLAttribsBase class. While WGL_/GLX_/NS attributes can be added, PFD_ (for MSW) can not.
Since
3.1.0

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

Public Member Functions

wxGLAttributesRGBA ()
 Use true colour instead of colour index rendering for each pixel. More...
 
wxGLAttributesBufferSize (int val)
 Specifies the number of bits for colour buffer. More...
 
wxGLAttributesLevel (int val)
 Specifies the framebuffer level. More...
 
wxGLAttributesDoubleBuffer ()
 Requests using double buffering. More...
 
wxGLAttributesStereo ()
 Use stereoscopic display. More...
 
wxGLAttributesAuxBuffers (int val)
 Specifies the number of auxiliary buffers. More...
 
wxGLAttributesMinRGBA (int mRed, int mGreen, int mBlue, int mAlpha)
 Specifies the minimal number of bits for each colour and alpha. More...
 
wxGLAttributesDepth (int val)
 Specifies number of bits for Z-buffer. More...
 
wxGLAttributesStencil (int val)
 Specifies number of bits for stencil buffer. More...
 
wxGLAttributesMinAcumRGBA (int mRed, int mGreen, int mBlue, int mAlpha)
 Specifies the minimal number of bits for each accumulator channel. More...
 
wxGLAttributesSampleBuffers (int val)
 Use multi-sampling support (antialiasing). More...
 
wxGLAttributesSamplers (int val)
 Specifies the number of samplers per pixel. More...
 
wxGLAttributesFrameBuffersRGB ()
 Used to request a frame buffer sRGB capable. More...
 
wxGLAttributesPlatformDefaults ()
 Set some typically needed attributes. More...
 
wxGLAttributesDefaults ()
 wxWidgets defaults: RGBA, Z-depth 16 bits, double buffering, 1 sample buffer, 4 samplers. 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

wxGLAttributes& wxGLAttributes::AuxBuffers ( int  val)

Specifies the number of auxiliary buffers.

Parameters
valThe number of auxiliary buffers.
wxGLAttributes& wxGLAttributes::BufferSize ( int  val)

Specifies the number of bits for colour buffer.

For RGBA it's normally the sum of the bits per each component.

Parameters
valThe number of bits.
wxGLAttributes& wxGLAttributes::Defaults ( )

wxWidgets defaults: RGBA, Z-depth 16 bits, double buffering, 1 sample buffer, 4 samplers.

See also
PlatformDefaults()
wxGLAttributes& wxGLAttributes::Depth ( int  val)

Specifies number of bits for Z-buffer.

Parameters
valNumber of bits for Z-buffer (typically 0, 16 or 32).
wxGLAttributes& wxGLAttributes::DoubleBuffer ( )

Requests using double buffering.

void wxGLAttributes::EndList ( )

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

wxGLAttributes& wxGLAttributes::FrameBuffersRGB ( )

Used to request a frame buffer sRGB capable.

It makes no effect for OS X.

wxGLAttributes& wxGLAttributes::Level ( int  val)

Specifies the framebuffer level.

It makes no effect for OS X.

Parameters
val0 for main buffer, >0 for overlay, <0 for underlay.
wxGLAttributes& wxGLAttributes::MinAcumRGBA ( int  mRed,
int  mGreen,
int  mBlue,
int  mAlpha 
)

Specifies the minimal number of bits for each accumulator channel.

On MSW and OSX this function also sets the size of the accumulation buffer.

Parameters
mRedThe minimal number of bits for red accumulator.
mGreenThe minimal number of bits for green accumulator.
mBlueThe minimal number of bits for blue accumulator.
mAlphaThe minimal number of bits for alpha accumulator.
wxGLAttributes& wxGLAttributes::MinRGBA ( int  mRed,
int  mGreen,
int  mBlue,
int  mAlpha 
)

Specifies the minimal number of bits for each colour and alpha.

On MSW and OSX this function also sets the size of the colour buffer.

Parameters
mRedThe minimal number of bits for colour red.
mGreenThe minimal number of bits for colour green.
mBlueThe minimal number of bits for colour blue.
mAlphaThe minimal number of bits for alpha channel.
wxGLAttributes& wxGLAttributes::PlatformDefaults ( )

Set some typically needed attributes.

E.g. full-acceleration on MSW.

See also
Defaults()
wxGLAttributes& wxGLAttributes::RGBA ( )

Use true colour instead of colour index rendering for each pixel.

It makes no effect for OS X.

wxGLAttributes& wxGLAttributes::SampleBuffers ( int  val)

Use multi-sampling support (antialiasing).

Parameters
valNumber of sample buffers, usually 1.
wxGLAttributes& wxGLAttributes::Samplers ( int  val)

Specifies the number of samplers per pixel.

Parameters
valNumber of samplers, e.g. 4 for 2x2 antialiasing.
wxGLAttributes& wxGLAttributes::Stencil ( int  val)

Specifies number of bits for stencil buffer.

Parameters
valNumber of bits.
wxGLAttributes& wxGLAttributes::Stereo ( )

Use stereoscopic display.