| Version: 3.2.8

Public Member Functions | List of all members
wxGLAttributes Class Reference
Class List by Category » OpenGL

`#include <wx/glcanvas.h>`

Inheritance diagram for wxGLAttributes:
[legend]

## 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();
wxGLAttributes
This class is used for setting display attributes when drawing through OpenGL ("Pixel format" in MSW ...
Definition: glcanvas.h:143
wxGLAttributes::PlatformDefaults
wxGLAttributes & PlatformDefaults()
Set some typically needed attributes.
wxGLAttributes::DoubleBuffer
wxGLAttributes & DoubleBuffer()
Requests using double buffering.
wxGLAttributes::Depth
wxGLAttributes & Depth(int val)
Specifies number of bits for Z-buffer.
wxGLAttributes::MinRGBA
wxGLAttributes & MinRGBA(int mRed, int mGreen, int mBlue, int mAlpha)
Specifies the minimal number of bits for each colour and alpha.
wxGLAttributes::EndList
void EndList()
The set of attributes must end with this one; otherwise, the GPU may display nothing at all.

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
wxGLAttributes & | RGBA ()
| Use true colour instead of colour index rendering for each pixel. More...
wxGLAttributes & | BufferSize (int val)
| Specifies the number of bits for colour buffer. More...
wxGLAttributes & | Level (int val)
| Specifies the framebuffer level. More...
wxGLAttributes & | DoubleBuffer ()
| Requests using double buffering. More...
wxGLAttributes & | Stereo ()
| Use stereoscopic display. More...
wxGLAttributes & | AuxBuffers (int val)
| Specifies the number of auxiliary buffers. More...
wxGLAttributes & | MinRGBA (int mRed, int mGreen, int mBlue, int mAlpha)
| Specifies the minimal number of bits for each colour and alpha. More...
wxGLAttributes & | Depth (int val)
| Specifies number of bits for Z-buffer. More...
wxGLAttributes & | Stencil (int val)
| Specifies number of bits for stencil buffer. More...
wxGLAttributes & | MinAcumRGBA (int mRed, int mGreen, int mBlue, int mAlpha)
| Specifies the minimal number of bits for each accumulator channel. More...
wxGLAttributes & | SampleBuffers (int val)
| Use multi-sampling support (antialiasing). More...
wxGLAttributes & | Samplers (int val)
| Specifies the number of samplers per pixel. More...
wxGLAttributes & | FrameBuffersRGB ()
| Used to request a frame buffer sRGB capable. More...
wxGLAttributes & | PlatformDefaults ()
| Set some typically needed attributes. More...
wxGLAttributes & | Defaults ()
| 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

## ◆ AuxBuffers()

wxGLAttributes& wxGLAttributes::AuxBuffers | ( | int | val | ) |

Specifies the number of auxiliary buffers.

Parameters

  val | The number of auxiliary buffers.

## ◆ BufferSize()

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

  val | The number of bits.

## ◆ Defaults()

wxGLAttributes& wxGLAttributes::Defaults | ( |  | ) |

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

See also
  PlatformDefaults()

## ◆ Depth()

wxGLAttributes& wxGLAttributes::Depth | ( | int | val | ) |

Specifies number of bits for Z-buffer.

Parameters

  val | Number of bits for Z-buffer (typically 0, 16 or 32).

## ◆ DoubleBuffer()

wxGLAttributes& wxGLAttributes::DoubleBuffer | ( |  | ) |

Requests using double buffering.

## ◆ EndList()

void wxGLAttributes::EndList | ( |  | ) |

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

## ◆ FrameBuffersRGB()

wxGLAttributes& wxGLAttributes::FrameBuffersRGB | ( |  | ) |

Used to request a frame buffer sRGB capable.

It makes no effect for macOS.

## ◆ Level()

wxGLAttributes& wxGLAttributes::Level | ( | int | val | ) |

Specifies the framebuffer level.

It makes no effect for macOS.

Parameters

  val | 0 for main buffer, >0 for overlay, <0 for underlay.

## ◆ MinAcumRGBA()

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

  mRed | The minimal number of bits for red accumulator.
  mGreen | The minimal number of bits for green accumulator.
  mBlue | The minimal number of bits for blue accumulator.
  mAlpha | The minimal number of bits for alpha accumulator.

## ◆ MinRGBA()

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

  mRed | The minimal number of bits for colour red.
  mGreen | The minimal number of bits for colour green.
  mBlue | The minimal number of bits for colour blue.
  mAlpha | The minimal number of bits for alpha channel.

## ◆ PlatformDefaults()

wxGLAttributes& wxGLAttributes::PlatformDefaults | ( |  | ) |

Set some typically needed attributes.

E.g. full-acceleration on MSW.

See also
  Defaults()

## ◆ RGBA()

wxGLAttributes& wxGLAttributes::RGBA | ( |  | ) |

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

It makes no effect for macOS.

## ◆ SampleBuffers()

wxGLAttributes& wxGLAttributes::SampleBuffers | ( | int | val | ) |

Use multi-sampling support (antialiasing).

Parameters

  val | Number of sample buffers, usually 1.

## ◆ Samplers()

wxGLAttributes& wxGLAttributes::Samplers | ( | int | val | ) |

Specifies the number of samplers per pixel.

Parameters

  val | Number of samplers, e.g. 4 for 2x2 antialiasing.

## ◆ Stencil()

wxGLAttributes& wxGLAttributes::Stencil | ( | int | val | ) |

Specifies number of bits for stencil buffer.

Parameters

  val | Number of bits.

## ◆ Stereo()

wxGLAttributes& wxGLAttributes::Stereo | ( |  | ) |

Use stereoscopic display.