Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Ogre::GTKGLSupport Class Reference

GL support in a GTK window. More...

#include <OgreGTKGLSupport.h>

Inheritance diagram for Ogre::GTKGLSupport:

Ogre::GLSupport Ogre::Singleton< GTKGLSupport > List of all members.

Public Member Functions

 GTKGLSupport ()
void addConfig ()
 Add any special config values to the system.
void setConfigOptions (const String &name, const String &value)
String validateConfig ()
 Make sure all the extra options are valid.
RenderWindow * createWindow (bool autoCreateWindow, GLRenderSystem *renderSystem, const String &windowTitle)
RenderWindow * newWindow (const String &name, unsigned int width, unsigned int height, unsigned int colourDepth, bool fullScreen, int left, int top, bool depthBuffer, RenderWindow *parentWindowHandle, bool vsync)
void start ()
 Start anything special.
void stop ()
 Stop anything special.
void begin_context (RenderTarget *_target=0)
void end_context ()
void initialiseExtensions (void)
 Intialises GL extensions, must be done AFTER the GL context has been established.
bool checkMinGLVersion (const String &v) const
 compare GL version numbers
bool checkExtension (const String &ext) const
 Check if an extension is available.
void * getProcAddress (const String &procname)
 Get the address of a function.
Glib::RefPtr< const Gdk::GL::Context > getMainContext () const
virtual void setConfigOption (const String &name, const String &value)
virtual ConfigOptionMap & getConfigOptions (void)
virtual RenderWindow * newWindow (const String &name, unsigned int width, unsigned int height, bool fullScreen, const NameValuePairList *miscParams=0)=0
 
Remarks:
This method creates a new rendering window as specified by the paramteters. The rendering system could be responible for only a single window (e.g. in the case of a game), or could be in charge of multiple ones (in the case of a level editor). The option to create the window as a child of another is therefore given. This method will create an appropriate subclass of RenderWindow depending on the API and platform implementation.
After creation, this window can be retrieved using getRenderTarget().
Parameters:
name The name of the window. Used in other methods later like setRenderTarget and getRenderWindow.
width The width of the new window.
height The height of the new window.
fullScreen Specify true to make the window full screen without borders, title bar or menu bar.
miscParams A NameValuePairList describing the other parameters for the new rendering window. Options are case sensitive. Unrecognised parameters will be ignored silently. These values might be platform dependent, but these are present for all platorms unless indicated otherwise:
Key: "title" Description: The title of the window that will appear in the title bar Values: string Default: RenderTarget name

Key: "colourDepth" Description: Colour depth of the resulting rendering window; only applies if fullScreen is set. Values: 16 or 32 Default: desktop depth Notes: [W32 specific]

Key: "left" Description: screen x coordinate from left Values: positive integers Default: 'center window on screen' Notes: Ignored in case of full screen

Key: "top" Description: screen y coordinate from top Values: positive integers Default: 'center window on screen' Notes: Ignored in case of full screen

Key: "depthBuffer" [DX9 specific] Description: Use depth buffer Values: false or true Default: true

Key: "externalWindowHandle" [API specific] Description: External window handle, for embedding the OGRE context Values: positive integer for W32 (HWND handle) poslong:posint:poslong (display*:screen:windowHandle) or poslong:posint:poslong:poslong (display*:screen:windowHandle:XVisualInfo*) for GLX Default: 0 (None)

Key: "parentWindowHandle" [API specific] Description: Parent window handle, for embedding the OGRE context Values: positive integer for W32 (HWND handle) poslong:posint:poslong for GLX (display*:screen:windowHandle) Default: 0 (None)

Key: "FSAA" Description: Full screen antialiasing factor Values: 0,2,4,6,... Default: 0

Key: "displayFrequency" Description: Display frequency rate, for fullscreen mode Values: 60...? Default: Desktop vsync rate

Key: "vsync" Description: Synchronize buffer swaps to vsync Values: true, false Default: 0

Key: "border" Description: The type of window border (in windowed mode) Values: none, fixed, resize Default: resize

Key: "outerDimensions" Description: Whether the width/height is expressed as the size of the outer window, rather than the content area Values: true, false Default: false

Key: "useNVPerfHUD" [DX9 specific] Description: Enable the use of nVidia NVPerfHUD Values: true, false Default: false

virtual bool supportsPBuffers ()
virtual GLPBuffer * createPBuffer (PixelComponentType format, size_t width, size_t height)
const String & getGLVendor (void) const
 get vendor information
const String & getGLVersion (void) const
 get version information
 Singleton (void)

Static Public Member Functions

static GTKGLSupport & getSingleton (void)
 Override standard Singleton retrieval.
static GTKGLSupport * getSingletonPtr (void)
 Override standard Singleton retrieval.

Protected Attributes

ConfigOptionMap mOptions
std::set< String > extensionList

Static Protected Attributes

static GTKGLSupport * ms_Singleton

Private Attributes

int _context_ref
Gtk::Main _kit
Glib::RefPtr< Gdk::GL::Context > _main_context
Glib::RefPtr< Gdk::GL::Window > _main_window

Detailed Description

GL support in a GTK window.

I made this a Singleton, so that the main context can be queried by GTKWindows.

Definition at line 44 of file OgreGTKGLSupport.h.


Constructor & Destructor Documentation

Ogre::GTKGLSupport::GTKGLSupport (   ) 
 


Member Function Documentation

void Ogre::GTKGLSupport::addConfig (   )  [virtual]
 

Add any special config values to the system.

Must have a "Full Screen" value that is a bool and a "Video Mode" value that is a string in the form of wxh

Implements Ogre::GLSupport.

void Ogre::GTKGLSupport::begin_context (  RenderTarget *  _target = 0  ) 
 

bool Ogre::GTKGLSupport::checkExtension (  const String &  ext  )  const [virtual]
 

Check if an extension is available.

Reimplemented from Ogre::GLSupport.

bool Ogre::GTKGLSupport::checkMinGLVersion (  const String &  v  )  const
 

compare GL version numbers

Reimplemented from Ogre::GLSupport.

virtual GLPBuffer* Ogre::GLSupport::createPBuffer (  PixelComponentType  format,
size_t  width,
size_t  height
)  [virtual, inherited]
 

Reimplemented in Ogre::GLXGLSupport, and Ogre::Win32GLSupport.

RenderWindow* Ogre::GTKGLSupport::createWindow (  bool  autoCreateWindow,
GLRenderSystem *  renderSystem,
const String &  windowTitle
)  [virtual]
 

Implements Ogre::GLSupport.

void Ogre::GTKGLSupport::end_context (   ) 
 

virtual ConfigOptionMap& Ogre::GLSupport::getConfigOptions (  void   )  [virtual, inherited]
 

const String& Ogre::GLSupport::getGLVendor (  void   )  const [inherited]
 

get vendor information

Definition at line 58 of file OgreGLSupport.h.

References Ogre::GLSupport::mVendor.

const String& Ogre::GLSupport::getGLVersion (  void   )  const [inherited]
 

get version information

Definition at line 66 of file OgreGLSupport.h.

References Ogre::GLSupport::mVersion.

Glib::RefPtr<const Gdk::GL::Context> Ogre::GTKGLSupport::getMainContext (   )  const
 

void* Ogre::GTKGLSupport::getProcAddress (  const String &  procname  )  [virtual]
 

Get the address of a function.

Implements Ogre::GLSupport.

static GTKGLSupport& Ogre::GTKGLSupport::getSingleton (  void   )  [static]
 

Override standard Singleton retrieval.

Remarks:
Why do we do this? Well, it's because the Singleton implementation is in a .h file, which means it gets compiled into anybody who includes it. This is needed for the Singleton template to work, but we actually only want it compiled into the implementation of the class based on the Singleton, not all of them. If we don't change this, we get link errors when trying to use the Singleton-based class from an outside dll.
This method just delegates to the template version anyway, but the implementation stays in this single compilation unit, preventing link errors.

Reimplemented from Ogre::Singleton< GTKGLSupport >.

static GTKGLSupport* Ogre::GTKGLSupport::getSingletonPtr (  void   )  [static]
 

Override standard Singleton retrieval.

Remarks:
Why do we do this? Well, it's because the Singleton implementation is in a .h file, which means it gets compiled into anybody who includes it. This is needed for the Singleton template to work, but we actually only want it compiled into the implementation of the class based on the Singleton, not all of them. If we don't change this, we get link errors when trying to use the Singleton-based class from an outside dll.
This method just delegates to the template version anyway, but the implementation stays in this single compilation unit, preventing link errors.

Reimplemented from Ogre::Singleton< GTKGLSupport >.

void Ogre::GTKGLSupport::initialiseExtensions (  void   )  [virtual]
 

Intialises GL extensions, must be done AFTER the GL context has been established.

Reimplemented from Ogre::GLSupport.

virtual RenderWindow* Ogre::GLSupport::newWindow (  const String &  name,
unsigned int  width,
unsigned int  height,
bool  fullScreen,
const NameValuePairList *  miscParams = 0
)  [pure virtual, inherited]
 

Remarks:
This method creates a new rendering window as specified by the paramteters. The rendering system could be responible for only a single window (e.g. in the case of a game), or could be in charge of multiple ones (in the case of a level editor). The option to create the window as a child of another is therefore given. This method will create an appropriate subclass of RenderWindow depending on the API and platform implementation.
After creation, this window can be retrieved using getRenderTarget().
Parameters:
name The name of the window. Used in other methods later like setRenderTarget and getRenderWindow.
width The width of the new window.
height The height of the new window.
fullScreen Specify true to make the window full screen without borders, title bar or menu bar.
miscParams A NameValuePairList describing the other parameters for the new rendering window. Options are case sensitive. Unrecognised parameters will be ignored silently. These values might be platform dependent, but these are present for all platorms unless indicated otherwise:
Key: "title" Description: The title of the window that will appear in the title bar Values: string Default: RenderTarget name

Key: "colourDepth" Description: Colour depth of the resulting rendering window; only applies if fullScreen is set. Values: 16 or 32 Default: desktop depth Notes: [W32 specific]

Key: "left" Description: screen x coordinate from left Values: positive integers Default: 'center window on screen' Notes: Ignored in case of full screen

Key: "top" Description: screen y coordinate from top Values: positive integers Default: 'center window on screen' Notes: Ignored in case of full screen

Key: "depthBuffer" [DX9 specific] Description: Use depth buffer Values: false or true Default: true

Key: "externalWindowHandle" [API specific] Description: External window handle, for embedding the OGRE context Values: positive integer for W32 (HWND handle) poslong:posint:poslong (display*:screen:windowHandle) or poslong:posint:poslong:poslong (display*:screen:windowHandle:XVisualInfo*) for GLX Default: 0 (None)

Key: "parentWindowHandle" [API specific] Description: Parent window handle, for embedding the OGRE context Values: positive integer for W32 (HWND handle) poslong:posint:poslong for GLX (display*:screen:windowHandle) Default: 0 (None)

Key: "FSAA" Description: Full screen antialiasing factor Values: 0,2,4,6,... Default: 0

Key: "displayFrequency" Description: Display frequency rate, for fullscreen mode Values: 60...? Default: Desktop vsync rate

Key: "vsync" Description: Synchronize buffer swaps to vsync Values: true, false Default: 0

Key: "border" Description: The type of window border (in windowed mode) Values: none, fixed, resize Default: resize

Key: "outerDimensions" Description: Whether the width/height is expressed as the size of the outer window, rather than the content area Values: true, false Default: false

Key: "useNVPerfHUD" [DX9 specific] Description: Enable the use of nVidia NVPerfHUD Values: true, false Default: false

Implemented in Ogre::GLXGLSupport, Ogre::SDLGLSupport, and Ogre::Win32GLSupport.

RenderWindow* Ogre::GTKGLSupport::newWindow (  const String &  name,
unsigned int  width,
unsigned int  height,
unsigned int  colourDepth,
bool  fullScreen,
int  left,
int  top,
bool  depthBuffer,
RenderWindow *  parentWindowHandle,
bool  vsync
) 
 

virtual void Ogre::GLSupport::setConfigOption (  const String &  name,
const String &  value
)  [virtual, inherited]
 

Reimplemented in Ogre::Win32GLSupport.

void Ogre::GTKGLSupport::setConfigOptions (  const String &  name,
const String &  value
) 
 

Ogre::Singleton< GTKGLSupport >::Singleton (  void   )  [inherited]
 

Definition at line 57 of file OgreSingleton.h.

void Ogre::GTKGLSupport::start (   )  [virtual]
 

Start anything special.

Implements Ogre::GLSupport.

void Ogre::GTKGLSupport::stop (   )  [virtual]
 

Stop anything special.

Implements Ogre::GLSupport.

virtual bool Ogre::GLSupport::supportsPBuffers (   )  [virtual, inherited]
 

Reimplemented in Ogre::Win32GLSupport.

String Ogre::GTKGLSupport::validateConfig (   )  [virtual]
 

Make sure all the extra options are valid.

Returns:
string with error message

Implements Ogre::GLSupport.


Member Data Documentation

int Ogre::GTKGLSupport::_context_ref [private]
 

Definition at line 101 of file OgreGTKGLSupport.h.

Gtk::Main Ogre::GTKGLSupport::_kit [private]
 

Definition at line 102 of file OgreGTKGLSupport.h.

Glib::RefPtr<Gdk::GL::Context> Ogre::GTKGLSupport::_main_context [private]
 

Definition at line 105 of file OgreGTKGLSupport.h.

Glib::RefPtr<Gdk::GL::Window> Ogre::GTKGLSupport::_main_window [private]
 

Definition at line 106 of file OgreGTKGLSupport.h.

std::set<String> Ogre::GLSupport::extensionList [protected, inherited]
 

Definition at line 95 of file OgreGLSupport.h.

ConfigOptionMap Ogre::GLSupport::mOptions [protected, inherited]
 

Definition at line 92 of file OgreGLSupport.h.

GTKGLSupport * Ogre::Singleton< GTKGLSupport >::ms_Singleton [static, protected, inherited]
 

Definition at line 54 of file OgreSingleton.h.


The documentation for this class was generated from the following file:

Copyright © 2000-2005 by The OGRE Team
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Jan 21 10:10:37 2007