1 #ifndef __DALI_INTERNAL_EGL_IMPLEMENTATION_H__
2 #define __DALI_INTERNAL_EGL_IMPLEMENTATION_H__
5 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
23 #include <EGL/eglext.h>
24 #include <dali/public-api/common/dali-vector.h>
27 #include <egl-interface.h>
38 * EglImplementation class provides an EGL implementation.
40 class EglImplementation : public EglInterface
51 virtual ~EglImplementation();
56 * (Called from ECoreX::RenderSurface, not RenderThread, so not in i/f, hence, not virtual)
58 * @param display The display
59 * @param isOwnSurface whether the surface is own or not
60 * @return true on success, false on failure
62 bool InitializeGles( EGLNativeDisplayType display, bool isOwnSurface = true );
65 * Create the OpenGL context.
66 * @return true if successful
68 virtual bool CreateContext();
71 * Destroy the OpenGL context.
73 void DestroyContext();
76 * Destroy the OpenGL surface.
78 void DestroySurface();
81 * Make the OpenGL context current
83 virtual void MakeContextCurrent();
86 * clear the OpenGL context
88 void MakeContextNull();
93 virtual void TerminateGles();
96 * Checks if GL is initialised
97 * @return true if it is
99 bool IsGlesInitialized() const;
102 * Performs an OpenGL swap buffers command
104 virtual void SwapBuffers();
107 * Performs an OpenGL copy buffers command
109 virtual void CopyBuffers();
112 * Performs an EGL wait GL command
114 virtual void WaitGL();
117 * Choose config of egl
118 * @param isWindowType whether the config for window or pixmap
119 * @param colorDepth Bit per pixel value (ex. 32 or 24)
121 void ChooseConfig( bool isWindowType, ColorDepth depth );
124 * Create an OpenGL surface using a window
125 * @param window The window to create the surface on
126 * @param colorDepth Bit per pixel value (ex. 32 or 24)
127 * @return true on success, false on failure
129 void CreateSurfaceWindow( EGLNativeWindowType window, ColorDepth depth );
132 * Create the OpenGL surface using a pixmap
133 * @param pixmap The pixmap to create the surface on
134 * @param colorDepth Bit per pixel value (ex. 32 or 24)
135 * @return true on success, false on failure
137 void CreateSurfacePixmap( EGLNativePixmapType pixmap, ColorDepth depth );
140 * Replaces the render surface
141 * @param[in] window, the window to create the new surface on
142 * @return true if the context was lost due to a change in display
143 * between old surface and new surface
145 bool ReplaceSurfaceWindow( EGLNativeWindowType window );
148 * Replaces the render surface
149 * @param[in] pixmap, the pixmap to create the new surface on
150 * @return true if the context was lost due to a change in x-display
151 * between old surface and new surface
153 bool ReplaceSurfacePixmap( EGLNativePixmapType pixmap );
156 * returns the display with which this object was initialized
157 * @return the EGL Display.
159 EGLDisplay GetDisplay() const;
162 * Returns the EGL context
163 * @return the EGL context.
165 EGLContext GetContext() const;
169 Vector<EGLint> mContextAttribs;
171 EGLNativeDisplayType mEglNativeDisplay;
172 EGLNativeWindowType mEglNativeWindow;
173 EGLNativePixmapType mEglNativePixmap;
175 EGLDisplay mEglDisplay;
176 EGLConfig mEglConfig;
177 EGLContext mEglContext;
178 EGLSurface mEglSurface;
180 bool mGlesInitialized;
182 bool mContextCurrent;
184 ColorDepth mColorDepth;
187 } // namespace Adaptor
189 } // namespace Internal
193 #endif // __DALI_INTERNAL_EGL_IMPLEMENTATION_H__