1 /***************************************************************************
3 * Copyright 2010,2011 BMW Car IT GmbH
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 ****************************************************************************/
19 #ifndef _OPENGLES2APP_H
20 #define _OPENGLES2APP_H
22 #include <GLES2/gl2.h>
25 #include "X11/Xutil.h"
28 struct SurfaceConfiguration
31 unsigned int surfaceId;
32 unsigned int surfaceWidth;
33 unsigned int surfaceHeight;
34 unsigned int surfacePosX;
35 unsigned int surfacePosY;
43 OpenGLES2App(float fps, float animationSpeed, SurfaceConfiguration* config);
44 virtual ~OpenGLES2App();
49 virtual void update(int currentTimeInMs, int elapsedTimeInMs) = 0;
50 virtual void render() = 0;
54 bool createX11Context(SurfaceConfiguration* config);
55 void destroyX11Context();
57 bool createEGLContext();
58 void destroyEglContext();
60 bool setupLayerMangement(SurfaceConfiguration* config);
62 unsigned int GetTickCount();
65 float m_framesPerSecond;
66 float m_animationSpeed;
67 unsigned int m_timerIntervalInMs;
69 struct EglContextStruct
71 EGLDisplay eglDisplay;
73 EGLSurface eglSurface;
74 EGLContext eglContext;
77 EglContextStruct m_eglContextStruct;
79 struct X11ContextStruct
84 XVisualInfo* x11Visual;
88 X11ContextStruct m_x11ContextStruct;
92 #endif /* _OPENGLES2APP_H */