Plus/include/gtk/OgreGTKGLSupport.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4 (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org
6 
7 Copyright (c) 2000-2009 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 
29 #ifndef INCL_OGRE_GTKGLSUPPORT_H
30 #define INCL_OGRE_GTKGLSUPPORT_H
31 
32 #include "OgreGL3PlusSupport.h"
33 
34 #include <gtkmm/main.h>
35 #include <gtkglmm.h>
36 
37 namespace Ogre {
38 
39 class OGREWidget;
40 
47 class GTKGLSupport : public GL3PlusSupport, public Singleton<GTKGLSupport>
48 {
49 public:
50  GTKGLSupport();
51  void addConfig();
52  void setConfigOptions(const String& name, const String& value);
54  RenderWindow* createWindow(bool autoCreateWindow,
55  GL3PlusRenderSystem* renderSystem, const String& windowTitle);
56  RenderWindow* newWindow(const String& name, unsigned int width, unsigned int height,
57  unsigned int colourDepth, bool fullScreen, int left, int top,
58  bool depthBuffer, RenderWindow* parentWindowHandle,
59  bool vsync);
60  void start();
61  void stop();
62  void begin_context(RenderTarget *_target = 0);
63  void end_context();
64  void initialiseExtensions(void);
65  bool checkMinGLVersion(const String& v) const;
66  bool checkExtension(const String& ext) const;
67  void* getProcAddress(const String& procname);
68 
69  Glib::RefPtr<const Gdk::GL::Context> getMainContext() const;
70 
86  static GTKGLSupport& getSingleton(void);
102  static GTKGLSupport* getSingletonPtr(void);
103 private:
104  int _context_ref;
105  Gtk::Main _kit;
106  //OGREWidget* _ogre_widget;
107 
108  Glib::RefPtr<Gdk::GL::Context> _main_context;
109  Glib::RefPtr<Gdk::GL::Window> _main_window;
110 }; // class GTKGLSupport
111 
112 }; // namespace Ogre
113 
114 #endif // INCL_OGRE_GTKGLSUPPORT_H
bool checkExtension(const String &ext) const
Check if an extension is available.
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 setConfigOptions(const String &name, const String &value)
void begin_context(RenderTarget *_target=0)
Glib::RefPtr< Gdk::GL::Context > _main_context
RenderWindow * createWindow(bool autoCreateWindow, GLRenderSystem *renderSystem, const String &windowTitle)
void addConfig()
Add any special config values to the system.
Glib::RefPtr< Gdk::GL::Window > _main_window
bool checkMinGLVersion(const String &v) const
static GTKGLSupport & getSingleton(void)
Override standard Singleton retrieval.
_StringBase String
void * getProcAddress(const String &procname)
Get the address of a function.
Glib::RefPtr< const Gdk::GL::Context > getMainContext() const
void stop()
Stop anything special.
static GTKGLSupport * getSingletonPtr(void)
Override standard Singleton retrieval.
String validateConfig()
Make sure all the extra options are valid.
void initialiseExtensions(void)
Initialises GL extensions, must be done AFTER the GL context has been established.
void start()
Start anything special.

Copyright © 2012 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Tue Mar 18 2014 19:15:25