wxGLAttribsBase Class Reference | wxWidgets

| Version: 3.2.11

Loading...
Searching...
No Matches
Public Member Functions | List of all members
wxGLAttribsBase Class Reference
Class List by Category » OpenGL

`#include </cygdrive/c/Users/Hamis/Cygwin-packaging/wxWidgets3.2/wxWidgets3.2-3.2.11-1.x86_64/src/wxWidgets-3.2.11/interface/wx/glcanvas.h>`

Inheritance diagram for wxGLAttribsBase:
[legend]

## Detailed Description

This is the base class for wxGLAttributes and wxGLContextAttrs.

It stores internally the list required by OS and OpenGL driver for setting display and rendering context attributes.

Normally this class is not used directly. But there's a case where it its member functions are useful: setting attributes not handled by wxWidgets. Suppose the OpenGL Board sets a new functionality of the context, by adding a new attribute (let's call it NEW_CTX_F) and also a new type of context by allowing a new bit value (let's call it NEW_BITS) for the CONTEXT_PROFILE_MASK_ARB value. These new values can be added to the list using code like this:

wxGLContextAttrs cxtAttrs;
// Some values
cxtAttrs.CoreProfile().OGLVersion(5, 0); // OGL 5.0, whenever available
cxtAttrs.PlatformDefaults();
// Values usually are platform-dependant named (even value assigned!)
#if defined(__WXMSW__)
cxtAttrs.AddAttribute(WGL_NEW_CTX_F);
cxtAttrs.AddAttribBits(WGL_CONTEXT_PROFILE_MASK_ARB, WGL_NEW_BITS);
#elif defined(__WXX11__)
cxtAttrs.AddAttribute(GLX_NEW_CTX_F);
cxtAttrs.AddAttribBits(GLX_CONTEXT_PROFILE_MASK_ARB, GLX_NEW_BITS);
#else
// Other platforms
#endif
cxtAttrs.EndList(); // Don't forget this
cxtAttrs.SetNeedsARB(true); // Context attributes are set by an ARB-function
wxGLAttribsBase::SetNeedsARB
void SetNeedsARB(bool needsARB=true)
Sets the necessity of using special ARB-functions (e.g.
wxGLAttribsBase::AddAttribBits
void AddAttribBits(int searchVal, int combineVal)
Combine (bitwise OR) a given value with the existing one, if any.
wxGLAttribsBase::AddAttribute
void AddAttribute(int attribute)
Adds an integer value to the list of attributes.
wxGLContextAttrs
This class is used for setting context attributes.
Definition glcanvas.h:301
wxGLContextAttrs::PlatformDefaults
wxGLContextAttrs & PlatformDefaults()
Set platform specific defaults.
wxGLContextAttrs::CoreProfile
wxGLContextAttrs & CoreProfile()
Request an OpenGL core profile for the context.
wxGLContextAttrs::OGLVersion
wxGLContextAttrs & OGLVersion(int vmayor, int vminor)
An easy way of requesting an OpenGL version.
wxGLContextAttrs::EndList
void EndList()
The set of attributes must end with this one; otherwise, the GPU may display nothing at all.

Since
  3.1.0

##

Library: wxGL
Category: OpenGL

See also
  wxGLCanvas, wxGLContext, wxGLContextAttrs, wxGLAttributes

## Public Member Functions
| wxGLAttribsBase ()
| Constructor.
void | AddAttribute (int attribute)
| Adds an integer value to the list of attributes.
void | AddAttribBits (int searchVal, int combineVal)
| Combine (bitwise OR) a given value with the existing one, if any.
void | SetNeedsARB (bool needsARB=true)
| Sets the necessity of using special ARB-functions (e.g.
void | Reset ()
| Delete contents and sets ARB-flag to false.
const int * | GetGLAttrs () const
| Returns a pointer to the internal list of attributes.
int | GetSize ()
| Returns the size of the internal list of attributes.
bool | NeedsARB () const
| Returns the current value of the ARB-flag.

## Constructor & Destructor Documentation

## ◆ wxGLAttribsBase()

wxGLAttribsBase::wxGLAttribsBase | ( |  | ) |

Constructor.

## Member Function Documentation

## ◆ AddAttribBits()

void wxGLAttribsBase::AddAttribBits | ( | int | searchVal,
|  | int | combineVal )

Combine (bitwise OR) a given value with the existing one, if any.

This function first searches for an identifier and then combines the given value with the value right after the identifier. If the identifier is not found, two new values (i.e. the identifier and the given value) are added to the list.

Parameters

  searchVal | The identifier to search for.
  combineVal | The value to combine with the existing one.

## ◆ AddAttribute()

void wxGLAttribsBase::AddAttribute | ( | int | attribute | ) |

Adds an integer value to the list of attributes.

Parameters

  attribute | The value to add.

## ◆ GetGLAttrs()

const int * wxGLAttribsBase::GetGLAttrs | ( |  | ) | const

Returns a pointer to the internal list of attributes.

It's very unlikely you need this function. If the list is empty the returned value is NULL.

## ◆ GetSize()

int wxGLAttribsBase::GetSize | ( |  | ) |

Returns the size of the internal list of attributes.

Remember that the last value in the list must be a '0' (zero). So, a minimal list is of size = 2, the first value is meaningful and the last is '0'.

## ◆ NeedsARB()

bool wxGLAttribsBase::NeedsARB | ( |  | ) | const

Returns the current value of the ARB-flag.

See also
  SetNeedsARB

## ◆ Reset()

void wxGLAttribsBase::Reset | ( |  | ) |

Delete contents and sets ARB-flag to false.

## ◆ SetNeedsARB()

void wxGLAttribsBase::SetNeedsARB | ( | bool | needsARB = true | ) |

Sets the necessity of using special ARB-functions (e.g.

wglCreateContextAttribsARB in MSW) for some of the attributes of the list. Multi-sampling and modern context require these ARB-functions.

Parameters

  needsARB | true if an ARB-function is needed for any of the attributes.

See also
  NeedsARB