Public Member Functions | Static Public Member Functions | Protected Member Functions

OpenGLContext Class Reference

A base class for types of OpenGL context. More...

List of all members.

Public Member Functions

virtual ~OpenGLContext ()
 Destructor.
virtual bool makeActive () const noexcept=0
 Makes this context the currently active one.
virtual bool makeInactive () const noexcept=0
 If this context is currently active, it is disactivated.
virtual bool isActive () const noexcept=0
 Returns true if this context is currently active.
virtual void swapBuffers ()=0
 Swaps the buffers (if the context can do this).
virtual bool setSwapInterval (int numFramesPerSwap)=0
 Sets whether the context checks the vertical sync before swapping.
virtual int getSwapInterval () const =0
 Returns the current swap-sync interval.
virtual const OpenGLPixelFormat getPixelFormat () const =0
 Returns the pixel format being used by this context.
virtual void updateWindowPosition (const Rectangle< int > &bounds)=0
 For windowed contexts, this moves the context within the bounds of its parent window.
virtual void repaint ()=0
 For windowed contexts, this triggers a repaint of the window.
virtual void * getRawContext () const noexcept=0
 Returns an OS-dependent handle to the raw GL context.
virtual void deleteContext ()=0
 Deletes the context.

Static Public Member Functions

static OpenGLContextgetCurrentContext ()
 Returns the context that's currently in active use by the calling thread.

Protected Member Functions

 OpenGLContext () noexcept

Detailed Description

A base class for types of OpenGL context.

An OpenGLComponent will supply its own context for drawing in its window.


Constructor & Destructor Documentation

virtual OpenGLContext::~OpenGLContext (  ) [virtual]

Destructor.

OpenGLContext::OpenGLContext (  ) [protected]

Member Function Documentation

virtual bool OpenGLContext::makeActive (  ) const [pure virtual]

Makes this context the currently active one.

virtual bool OpenGLContext::makeInactive (  ) const [pure virtual]

If this context is currently active, it is disactivated.

virtual bool OpenGLContext::isActive (  ) const [pure virtual]

Returns true if this context is currently active.

virtual void OpenGLContext::swapBuffers (  ) [pure virtual]

Swaps the buffers (if the context can do this).

virtual bool OpenGLContext::setSwapInterval ( int  numFramesPerSwap ) [pure virtual]

Sets whether the context checks the vertical sync before swapping.

The value is the number of frames to allow between buffer-swapping. This is fairly system-dependent, but 0 turns off syncing, 1 makes it swap on frame-boundaries, and greater numbers indicate that it should swap less often.

Returns true if it sets the value successfully.

virtual int OpenGLContext::getSwapInterval (  ) const [pure virtual]

Returns the current swap-sync interval.

See setSwapInterval() for info about the value returned.

virtual const OpenGLPixelFormat OpenGLContext::getPixelFormat (  ) const [pure virtual]

Returns the pixel format being used by this context.

virtual void OpenGLContext::updateWindowPosition ( const Rectangle< int > &  bounds ) [pure virtual]

For windowed contexts, this moves the context within the bounds of its parent window.

virtual void OpenGLContext::repaint (  ) [pure virtual]

For windowed contexts, this triggers a repaint of the window.

(Not relevent on all platforms).

virtual void* OpenGLContext::getRawContext (  ) const [pure virtual]

Returns an OS-dependent handle to the raw GL context.

On win32, this will be a HGLRC; on the Mac, an AGLContext; on Linux, a GLXContext.

virtual void OpenGLContext::deleteContext (  ) [pure virtual]

Deletes the context.

This must only be called on the message thread, or will deadlock. On background threads, call getCurrentContext()->deleteContext(), but be careful not to call any other OpenGL function afterwards. This doesn't touch other resources, such as window handles, etc. You'll probably never have to call this method directly.

static OpenGLContext* OpenGLContext::getCurrentContext (  ) [static]

Returns the context that's currently in active use by the calling thread.

Returns 0 if there isn't an active context.


The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines