From a2c990bd260aa16cb7a2e86ad2fa50d3881806b0 Mon Sep 17 00:00:00 2001 From: Bim Overbohm Date: Wed, 15 May 2013 09:50:59 +0200 Subject: [PATCH] Fix compile errors on Rasbian Add proper EGL/GLES libraries. Change glVertexPointer() call, because GLES only can use GL_BYTE, GL_SHORT, GL_FIXED and GL_FLOAT... --- CMakeLists.txt | 42 +++++++++++++++++++++------------------- src/Renderer_draw_gl.cpp | 8 ++++++++ 2 files changed, 30 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 22be6ae3e..38b680ff2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,16 +69,6 @@ set(ES_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ) -if(${GLSystem} MATCHES "Desktop OpenGL") - LIST(APPEND ES_INCLUDE_DIRS - ${OPENGL_INCLUDE_DIR} - ) -else() - LIST(APPEND ES_INCLUDE_DIRS - ${OPENGLES_INCLUDE_DIR} - ) -endif() - if(DEFINED BCMHOST) LIST(APPEND ES_INCLUDE_DIRS "/opt/vc/include" @@ -86,6 +76,16 @@ if(DEFINED BCMHOST) "/opt/vc/include/interface/vmcs_host/linux" "/opt/vc/include/interface/vcos/pthreads" ) +else() + if(${GLSystem} MATCHES "Desktop OpenGL") + LIST(APPEND ES_INCLUDE_DIRS + ${OPENGL_INCLUDE_DIR} + ) + else() + LIST(APPEND ES_INCLUDE_DIRS + ${OPENGLES_INCLUDE_DIR} + ) + endif() endif() #------------------------------------------------------------------------------- @@ -172,20 +172,22 @@ set(ES_LIBRARIES boost_system ) -if(${GLSystem} MATCHES "Desktop OpenGL") - LIST(APPEND ES_LIBRARIES - ${OPENGL_LIBRARIES} - ) -else() - LIST(APPEND ES_LIBRARIES - ${OPENGLES_LIBRARIES} - ) -endif() - if(DEFINED BCMHOST) LIST(APPEND ES_LIBRARIES bcm_host + EGL + GLESv1_CM ) +else() + if(${GLSystem} MATCHES "Desktop OpenGL") + LIST(APPEND ES_LIBRARIES + ${OPENGL_LIBRARIES} + ) + else() + LIST(APPEND ES_LIBRARIES + ${OPENGLES_LIBRARIES} + ) + endif() endif() if(DEFINED BCMHOST) diff --git a/src/Renderer_draw_gl.cpp b/src/Renderer_draw_gl.cpp index 9cdcbba9c..ee2058d30 100644 --- a/src/Renderer_draw_gl.cpp +++ b/src/Renderer_draw_gl.cpp @@ -28,7 +28,11 @@ namespace Renderer { void drawRect(int x, int y, int w, int h, unsigned int color) { +#ifdef USE_OPENGL_ES + GLshort points[12]; +#else GLint points[12]; +#endif points[0] = x; points [1] = y; points[2] = x; points[3] = y + h; @@ -46,7 +50,11 @@ namespace Renderer { glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_COLOR_ARRAY); +#ifdef USE_OPENGL_ES + glVertexPointer(2, GL_SHORT, 0, points); +#else glVertexPointer(2, GL_INT, 0, points); +#endif glColorPointer(4, GL_UNSIGNED_BYTE, 0, colors); glDrawArrays(GL_TRIANGLES, 0, 6);