Qt: Use GLES2 if enabled and GL isn't found

This commit is contained in:
Jeffrey Pfau 2015-07-30 15:14:19 -07:00
parent 46e24e84da
commit 903a8a654d
3 changed files with 18 additions and 0 deletions

View File

@ -38,7 +38,13 @@ if(NOT Qt5OpenGL_FOUND OR NOT Qt5Widgets_FOUND OR NOT OPENGL_FOUND)
return()
endif()
if(BUILD_GL)
list(APPEND PLATFORM_SRC ${PLATFORM_SRC} ${CMAKE_SOURCE_DIR}/src/platform/opengl/gl.c)
endif()
if(BUILD_GLES2)
list(APPEND PLATFORM_SRC ${PLATFORM_SRC} ${CMAKE_SOURCE_DIR}/src/platform/opengl/gles2.c)
endif()
get_target_property(QT_TYPE Qt5::Core TYPE)
if(QT_TYPE STREQUAL STATIC_LIBRARY)

View File

@ -135,7 +135,11 @@ PainterGL::PainterGL(QGLWidget* parent)
, m_context(nullptr)
, m_messagePainter(nullptr)
{
#ifdef BUILD_GL
GBAGLContextCreate(&m_backend);
#elif defined(BUILD_GLES2)
GBAGLES2ContextCreate(&m_backend);
#endif
m_backend.d.swap = [](VideoBackend* v) {
PainterGL* painter = static_cast<PainterGL*>(v->user);
painter->m_gl->swapBuffers();

View File

@ -14,7 +14,11 @@
#include <QTimer>
extern "C" {
#ifdef BUILD_GL
#include "platform/opengl/gl.h"
#elif defined(BUILD_GLES2)
#include "platform/opengl/gles2.h"
#endif
}
struct GBAThread;
@ -90,7 +94,11 @@ private:
QGLWidget* m_gl;
bool m_active;
GBAThread* m_context;
#ifdef BUILD_GL
GBAGLContext m_backend;
#elif defined(BUILD_GLES2)
GBAGLES2Context m_backend;
#endif
QSize m_size;
MessagePainter* m_messagePainter;
};