c20fe0780729d5f059e09cc0ea98fbdadff96a47
[platform/core/uifw/dali-adaptor.git] / adaptors / base / interfaces / egl-interface.h
1 #ifndef __DALI_INTERNAL_ADAPTOR_BASE_EGL_INTERFACE_H__
2 #define __DALI_INTERNAL_ADAPTOR_BASE_EGL_INTERFACE_H__
3
4 //
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
6 //
7 // Licensed under the Flora License, Version 1.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
10 //
11 //     http://floralicense.org/license/
12 //
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.
18 //
19
20 namespace Dali
21 {
22 namespace Internal
23 {
24 namespace Adaptor
25 {
26
27 /**
28  * EglInterface provides an interface for managing EGL contexts
29  */
30 class EglInterface
31 {
32 public:
33   enum  SyncMode
34   {
35     NO_SYNC      = 0,  ///< not synchronised to display (driver might over-ride?)
36     FULL_SYNC    = 1,  ///< redraw at display refresh rate
37     HALF_SYNC    = 2,  ///< redraw at half display refresh rate
38     QUARTER_SYNC = 4   ///< redraw at quarter display refresh rate
39   };
40
41   /**
42     * Create the OpenGL context.
43     * @return true if successful
44     */
45   virtual bool CreateContext() = 0;
46
47   /**
48    * Make the OpenGL context current
49    */
50   virtual void MakeContextCurrent() = 0;
51
52   /**
53    * Terminate GL
54    */
55   virtual void TerminateGles() = 0;
56
57   /**
58    * Sets the refresh sync mode.
59    * @see SyncMode
60    */
61   virtual bool SetRefreshSync( SyncMode mode ) = 0;
62
63   /**
64    * Performs an OpenGL swap buffers command
65    */
66   virtual void SwapBuffers() = 0;
67
68   /**
69    * Performs an OpenGL copy buffers command
70    */
71   virtual void CopyBuffers() = 0;
72
73   /**
74    * Performs an EGL wait GL command
75    */
76   virtual void WaitGL() = 0;
77
78 protected:
79   /**
80    * Virtual protected destructor, no deletion through this interface
81    */
82   virtual ~EglInterface() {}
83 };
84
85 } // namespace Adaptor
86
87 } // namespace Internal
88
89 } // namespace Dali
90
91 #endif // __DALI_INTERNAL_ADAPTOR_BASE_EGL_INTERFACE_H__
92