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...
This commit is contained in:
Bim Overbohm 2013-05-15 09:50:59 +02:00
parent 1f91fe6cdf
commit a2c990bd26
2 changed files with 30 additions and 20 deletions

View file

@ -69,6 +69,14 @@ set(ES_INCLUDE_DIRS
${Boost_INCLUDE_DIRS}
)
if(DEFINED BCMHOST)
LIST(APPEND ES_INCLUDE_DIRS
"/opt/vc/include"
"/opt/vc/include/interface/vcos"
"/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}
@ -78,14 +86,6 @@ else()
${OPENGLES_INCLUDE_DIR}
)
endif()
if(DEFINED BCMHOST)
LIST(APPEND ES_INCLUDE_DIRS
"/opt/vc/include"
"/opt/vc/include/interface/vcos"
"/opt/vc/include/interface/vmcs_host/linux"
"/opt/vc/include/interface/vcos/pthreads"
)
endif()
#-------------------------------------------------------------------------------
@ -172,6 +172,13 @@ set(ES_LIBRARIES
boost_system
)
if(DEFINED BCMHOST)
LIST(APPEND ES_LIBRARIES
bcm_host
EGL
GLESv1_CM
)
else()
if(${GLSystem} MATCHES "Desktop OpenGL")
LIST(APPEND ES_LIBRARIES
${OPENGL_LIBRARIES}
@ -181,11 +188,6 @@ else()
${OPENGLES_LIBRARIES}
)
endif()
if(DEFINED BCMHOST)
LIST(APPEND ES_LIBRARIES
bcm_host
)
endif()
if(DEFINED BCMHOST)

View file

@ -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);