1 /***************************************************************************
3 * Copyright 2010 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 ****************************************************************************/
20 #include "X11GLESRenderer.h"
21 #include "ShaderProgramGLES.h"
22 #include "GraphicSystems/GLESGraphicSystem.h"
23 #include "WindowSystems/X11WindowSystem.h"
25 #include "TextureBinders/X11CopyGLES.h"
26 #include "TextureBinders/X11EglImage.h"
28 X11GLESRenderer::X11GLESRenderer(LayerList* layerlist) : BaseRenderer(layerlist)
30 LOG_DEBUG("X11GLESRenderer", "Creating Renderer");
32 // if no binder has been set yet
33 Display* display = XOpenDisplay(0);
34 EGLDisplay m_eglDisplay = eglGetDisplay(display);
35 ITextureBinder* binder=NULL;
36 const char* query = eglQueryString(m_eglDisplay, EGL_EXTENSIONS);
37 LOG_DEBUG("X11GLESRenderer", "EGL_EXTENSIONS: " << query);
38 #ifdef EGL_NATIVE_PIXMAP_KHR
39 binder = new X11EglImage((Display*)display);
41 binder = new X11CopyGLES((Display*)display);
44 BaseGraphicSystem* graphicSystem = new GLESGraphicsystem( ShaderProgramGLES::createProgram, binder);
45 m_windowSystem = new X11WindowSystem(layerlist, graphicSystem);
48 extern "C" BaseRenderer* createX11GLESRenderer(LayerList* layerlist){
49 return new X11GLESRenderer(layerlist);
52 extern "C" void destroyX11GLESRenderer(X11GLESRenderer* p){