OGRE  2.0
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
/include/EGL/OgreEGLSupport.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) 2008 Renato Araujo Oliveira Filho <renatox@gmail.com>
8 Copyright (c) 2000-2014 Torus Knot Software Ltd
9 
10 Permission is hereby granted, free of charge, to any person obtaining a copy
11 of this software and associated documentation files (the "Software"), to deal
12 in the Software without restriction, including without limitation the rights
13 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14 copies of the Software, and to permit persons to whom the Software is
15 furnished to do so, subject to the following conditions:
16 
17 The above copyright notice and this permission notice shall be included in
18 all copies or substantial portions of the Software.
19 
20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26 THE SOFTWARE.
27 -----------------------------------------------------------------------------
28 */
29 
30 #ifndef __EGLSupport_H__
31 #define __EGLSupport_H__
32 
33 
34 #include "OgreGLES2Support.h"
35 //#include "OgreGLES2Prerequisites.h"
36 //#include "OgreGLESPBuffer.h"
37 #include "OgreEGLWindow.h"
38 
39 namespace Ogre {
40  template<class C> void removeDuplicates(C& c)
41  {
42  std::sort(c.begin(), c.end());
43  typename C::iterator p = std::unique(c.begin(), c.end());
44  c.erase(p, c.end());
45  }
46 
47  class _OgrePrivate EGLSupport : public GLES2Support
48  {
49  protected:
50  void refreshConfig(void);
51 
52  EGLDisplay mGLDisplay;
53  NativeDisplayType mNativeDisplay;
54 
55  bool mIsExternalDisplay;
56  bool mRandr;
57  typedef std::pair<uint, uint> ScreenSize;
58  typedef short Rate;
59  typedef std::pair<ScreenSize, Rate> VideoMode;
60  typedef std::vector<VideoMode> VideoModes;
61  VideoModes mVideoModes;
62  VideoMode mOriginalMode;
63  VideoMode mCurrentMode;
64  StringVector mSampleLevels;
65 
66  //virtual EGLWindow* createEGLWindow( EGLSupport * support) = 0;
67  public:
68  EGLSupport();
69  virtual ~EGLSupport();
70 
71  void start(void);
72  void stop(void);
73  void addConfig(void);
74  String validateConfig(void);
75  void setConfigOption(const String &name, const String &value);
76  virtual String getDisplayName (void);
77  EGLDisplay getGLDisplay(void);
78  void setGLDisplay(EGLDisplay val);
79  EGLConfig* chooseGLConfig(const EGLint *attribList, EGLint *nElements);
80  EGLConfig* getConfigs(EGLint *nElements);
81  EGLBoolean getGLConfigAttrib(EGLConfig fbConfig, EGLint attribute, EGLint *value);
82  void* getProcAddress(const Ogre::String& name);
83  ::EGLContext createNewContext(EGLDisplay eglDisplay, ::EGLConfig glconfig, ::EGLContext shareList) const;
84 
85  RenderWindow* createWindow(bool autoCreateWindow,
86  GLES2RenderSystem *renderSystem,
87  const String& windowTitle);
88 
89 // RenderWindow* newWindow(const String& name,
90 // unsigned int width, unsigned int height,
91 // bool fullScreen,
92 // const NameValuePairList *miscParams = 0);
93 
94  ::EGLConfig getGLConfigFromContext(::EGLContext context);
95  ::EGLConfig getGLConfigFromDrawable(::EGLSurface drawable,
96  unsigned int *w, unsigned int *h);
97  ::EGLConfig selectGLConfig (const EGLint* minAttribs, const EGLint *maxAttribs);
98  void switchMode(void);
99  virtual void switchMode(uint& width, uint& height, short& frequency) = 0;
100  // virtual GLES2PBuffer* createPBuffer(PixelComponentType format,
101  // size_t width, size_t height) = 0;
102 // NativeDisplayType getNativeDisplay();
103  };
104 }
105 
106 #endif
Manages the target rendering window.
std::pair< ScreenSize, Rate > VideoMode
Implementation of GL ES 2.x as a rendering system.
#define _OgrePrivate
Definition: OgrePlatform.h:256
vector< String >::type StringVector
std::pair< uint, uint > ScreenSize
_StringBase String
Definition: OgreCommon.h:53
std::vector< VideoMode > VideoModes
void removeDuplicates(C &c)
unsigned int uint