source: OGRE/trunk/ogrenew/RenderSystems/GL/include/gtk/OgreGTKGLSupport.h @ 692

Revision 692, 4.2 KB checked in by mattausch, 19 years ago (diff)

adding ogre 1.2 and dependencies

Line 
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4(Object-oriented Graphics Rendering Engine)
5For the latest info, see http://ogre.sourceforge.net/
6
7Copyright (c) 2000-2005 The OGRE Team
8Also see acknowledgements in Readme.html
9
10This program is free software; you can redistribute it and/or modify it under
11the terms of the GNU Lesser General Public License as published by the Free Software
12Foundation; either version 2 of the License, or (at your option) any later
13version.
14
15This program is distributed in the hope that it will be useful, but WITHOUT
16ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
18
19You should have received a copy of the GNU Lesser General Public License along with
20this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21Place - Suite 330, Boston, MA 02111-1307, USA, or go to
22http://www.gnu.org/copyleft/lesser.txt.
23-----------------------------------------------------------------------------
24*/
25
26#ifndef INCL_OGRE_GTKGLSUPPORT_H
27#define INCL_OGRE_GTKGLSUPPORT_H
28
29#include "OgreGLSupport.h"
30
31#include <gtkmm/main.h>
32#include <gtkglmm.h>
33
34namespace Ogre {
35
36class OGREWidget;
37
38/**
39 * GL support in a GTK window.
40 *
41 * I made this a Singleton, so that the main context can be queried by
42 * GTKWindows.
43 */
44class GTKGLSupport : public GLSupport, public Singleton<GTKGLSupport>
45{
46public:
47    GTKGLSupport();
48    void addConfig();
49    void setConfigOptions(const String& name, const String& value);
50    String validateConfig();
51    RenderWindow* createWindow(bool autoCreateWindow,
52                               GLRenderSystem* renderSystem, const String& windowTitle);
53    RenderWindow* newWindow(const String& name, unsigned int width, unsigned int height,
54                            unsigned int colourDepth, bool fullScreen, int left, int top,
55                            bool depthBuffer, RenderWindow* parentWindowHandle,
56                            bool vsync);
57    void start();
58    void stop();
59    void begin_context(RenderTarget *_target = 0);
60    void end_context();
61    void initialiseExtensions(void);
62    bool checkMinGLVersion(const String& v) const;
63    bool checkExtension(const String& ext) const;
64    void* getProcAddress(const String& procname);
65
66    Glib::RefPtr<const Gdk::GL::Context> getMainContext() const;
67
68    /** Override standard Singleton retrieval.
69    @remarks
70    Why do we do this? Well, it's because the Singleton
71    implementation is in a .h file, which means it gets compiled
72    into anybody who includes it. This is needed for the
73    Singleton template to work, but we actually only want it
74    compiled into the implementation of the class based on the
75    Singleton, not all of them. If we don't change this, we get
76    link errors when trying to use the Singleton-based class from
77    an outside dll.
78    @par
79    This method just delegates to the template version anyway,
80    but the implementation stays in this single compilation unit,
81    preventing link errors.
82    */
83    static GTKGLSupport& getSingleton(void);
84    /** Override standard Singleton retrieval.
85    @remarks
86    Why do we do this? Well, it's because the Singleton
87    implementation is in a .h file, which means it gets compiled
88    into anybody who includes it. This is needed for the
89    Singleton template to work, but we actually only want it
90    compiled into the implementation of the class based on the
91    Singleton, not all of them. If we don't change this, we get
92    link errors when trying to use the Singleton-based class from
93    an outside dll.
94    @par
95    This method just delegates to the template version anyway,
96    but the implementation stays in this single compilation unit,
97    preventing link errors.
98    */
99    static GTKGLSupport* getSingletonPtr(void);
100private:
101    int _context_ref;
102    Gtk::Main _kit;
103    //OGREWidget* _ogre_widget;
104
105    Glib::RefPtr<Gdk::GL::Context> _main_context;
106    Glib::RefPtr<Gdk::GL::Window> _main_window;
107}; // class GTKGLSupport
108
109}; // namespace Ogre
110
111#endif // INCL_OGRE_GTKGLSUPPORT_H
Note: See TracBrowser for help on using the repository browser.