mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 04:23:33 +02:00
Allow GLES client on desktop builds
This commit is contained in:
parent
800b7963f2
commit
22d133c71f
12 changed files with 115 additions and 75 deletions
|
@ -39,14 +39,26 @@ else()
|
||||||
option(BUILD_TESTS "Build tests" ON)
|
option(BUILD_TESTS "Build tests" ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (ANDROID)
|
if (ANDROID)
|
||||||
|
option(USE_GLES "Use OpenGL ES" ON)
|
||||||
set(PLATFORM_QT_COMPONENTS AndroidExtras WebView)
|
set(PLATFORM_QT_COMPONENTS AndroidExtras WebView)
|
||||||
set(PLATFORM_GL_BACKEND gpu-gles)
|
|
||||||
else ()
|
else ()
|
||||||
|
option(USE_GLES "Use OpenGL ES" OFF)
|
||||||
set(PLATFORM_QT_COMPONENTS WebEngine WebEngineWidgets)
|
set(PLATFORM_QT_COMPONENTS WebEngine WebEngineWidgets)
|
||||||
set(PLATFORM_GL_BACKEND gpu-gl)
|
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
set(PLATFORM_QT_GL OpenGL)
|
||||||
|
|
||||||
|
if (USE_GLES)
|
||||||
|
add_definitions(-DUSE_GLES)
|
||||||
|
set(PLATFORM_GL_BACKEND gpu-gles)
|
||||||
|
else()
|
||||||
|
set(PLATFORM_GL_BACKEND gpu-gl)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
foreach(PLATFORM_QT_COMPONENT ${PLATFORM_QT_COMPONENTS})
|
foreach(PLATFORM_QT_COMPONENT ${PLATFORM_QT_COMPONENTS})
|
||||||
list(APPEND PLATFORM_QT_LIBRARIES "Qt5::${PLATFORM_QT_COMPONENT}")
|
list(APPEND PLATFORM_QT_LIBRARIES "Qt5::${PLATFORM_QT_COMPONENT}")
|
||||||
endforeach()
|
endforeach()
|
||||||
|
@ -59,6 +71,7 @@ MESSAGE(STATUS "Build client: " ${BUILD_CLIENT})
|
||||||
MESSAGE(STATUS "Build tests: " ${BUILD_TESTS})
|
MESSAGE(STATUS "Build tests: " ${BUILD_TESTS})
|
||||||
MESSAGE(STATUS "Build tools: " ${BUILD_TOOLS})
|
MESSAGE(STATUS "Build tools: " ${BUILD_TOOLS})
|
||||||
MESSAGE(STATUS "Build installer: " ${BUILD_INSTALLER})
|
MESSAGE(STATUS "Build installer: " ${BUILD_INSTALLER})
|
||||||
|
MESSAGE(STATUS "GL ES: " ${USE_GLES})
|
||||||
|
|
||||||
if (UNIX AND DEFINED ENV{HIFI_MEMORY_DEBUGGING})
|
if (UNIX AND DEFINED ENV{HIFI_MEMORY_DEBUGGING})
|
||||||
MESSAGE(STATUS "Memory debugging is enabled")
|
MESSAGE(STATUS "Memory debugging is enabled")
|
||||||
|
|
|
@ -6,22 +6,33 @@
|
||||||
# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
#
|
#
|
||||||
macro(TARGET_OPENGL)
|
macro(TARGET_OPENGL)
|
||||||
if (APPLE)
|
if (ANDROID)
|
||||||
# link in required OS X frameworks and include the right GL headers
|
find_library(EGL EGL)
|
||||||
find_library(OpenGL OpenGL)
|
find_library(OpenGLES3 GLESv3)
|
||||||
target_link_libraries(${TARGET_NAME} ${OpenGL})
|
list(APPEND IGNORE_COPY_LIBS ${OpenGLES3} ${OpenGLES2} ${EGL})
|
||||||
elseif(ANDROID)
|
target_link_libraries(${TARGET_NAME} ${OpenGLES3} ${EGL})
|
||||||
find_library(EGL EGL)
|
elseif (USE_GLES)
|
||||||
find_library(OpenGLES3 GLESv3)
|
set(ANGLE_INCLUDE_DIR "${QT_DIR}/include/QtANGLE")
|
||||||
list(APPEND IGNORE_COPY_LIBS ${OpenGLES3} ${OpenGLES2} ${EGL})
|
set(ANGLE_LIB_DIR "${QT_DIR}/lib")
|
||||||
target_link_libraries(${TARGET_NAME} ${OpenGLES3} ${EGL})
|
find_library(EGL_LIBRARY_RELEASE "libEGL" HINTS ${ANGLE_LIB_DIR})
|
||||||
|
find_library(EGL_LIBRARY_DEBUG "libEGLd" HINTS ${ANGLE_LIB_DIR})
|
||||||
|
find_library(GLES_LIBRARY_RELEASE "libGLESv2" HINTS ${ANGLE_LIB_DIR})
|
||||||
|
find_library(GLES_LIBRARY_DEBUG "libGLESv2d" HINTS ${ANGLE_LIB_DIR})
|
||||||
|
include(SelectLibraryConfigurations)
|
||||||
|
select_library_configurations(EGL)
|
||||||
|
select_library_configurations(GLES)
|
||||||
|
message("QQQ ${GLES_LIBRARIES}")
|
||||||
|
target_link_libraries(${TARGET_NAME} ${EGL_LIBRARIES})
|
||||||
|
target_link_libraries(${TARGET_NAME} ${GLES_LIBRARIES})
|
||||||
|
target_include_directories(${TARGET_NAME} PUBLIC "${ANGLE_INCLUDE_DIR}")
|
||||||
|
elseif (APPLE)
|
||||||
|
# link in required OS X frameworks and include the right GL headers
|
||||||
|
find_library(OpenGL OpenGL)
|
||||||
|
target_link_libraries(${TARGET_NAME} ${OpenGL})
|
||||||
else()
|
else()
|
||||||
find_package(OpenGL REQUIRED)
|
find_package(OpenGL REQUIRED)
|
||||||
if (${OPENGL_INCLUDE_DIR})
|
target_link_libraries(${TARGET_NAME} "${OPENGL_LIBRARY}")
|
||||||
include_directories(SYSTEM "${OPENGL_INCLUDE_DIR}")
|
target_include_directories(${TARGET_NAME} PUBLIC ${OPENGL_INCLUDE_DIR})
|
||||||
endif()
|
|
||||||
target_link_libraries(${TARGET_NAME} "${OPENGL_LIBRARY}")
|
|
||||||
target_include_directories(${TARGET_NAME} PUBLIC ${OPENGL_INCLUDE_DIR})
|
|
||||||
endif()
|
endif()
|
||||||
target_nsight()
|
target_nsight()
|
||||||
target_glew()
|
target_glew()
|
||||||
|
|
|
@ -49,6 +49,11 @@ int main(int argc, const char* argv[]) {
|
||||||
CrashReporter crashReporter { BUG_SPLAT_DATABASE, BUG_SPLAT_APPLICATION_NAME, BuildInfo::VERSION };
|
CrashReporter crashReporter { BUG_SPLAT_DATABASE, BUG_SPLAT_APPLICATION_NAME, BuildInfo::VERSION };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if USE_GLES
|
||||||
|
qputenv("QT_ANGLE_PLATFORM", "d3d11");
|
||||||
|
QCoreApplication::setAttribute(Qt::AA_UseOpenGLES);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef Q_OS_LINUX
|
#ifdef Q_OS_LINUX
|
||||||
QApplication::setAttribute(Qt::AA_DontUseNativeMenuBar);
|
QApplication::setAttribute(Qt::AA_DontUseNativeMenuBar);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
#if defined(Q_OS_ANDROID)
|
#if defined(HIFI_GLES)
|
||||||
PFNGLQUERYCOUNTEREXTPROC __glQueryCounterEXT = NULL;
|
PFNGLQUERYCOUNTEREXTPROC __glQueryCounterEXT = NULL;
|
||||||
PFNGLGETQUERYOBJECTUI64VEXTPROC __glGetQueryObjectui64vEXT = NULL;
|
PFNGLGETQUERYOBJECTUI64VEXTPROC __glGetQueryObjectui64vEXT = NULL;
|
||||||
PFNGLFRAMEBUFFERTEXTUREEXTPROC __glFramebufferTextureEXT = NULL;
|
PFNGLFRAMEBUFFERTEXTUREEXTPROC __glFramebufferTextureEXT = NULL;
|
||||||
|
@ -22,7 +22,7 @@ PFNGLFRAMEBUFFERTEXTUREEXTPROC __glFramebufferTextureEXT = NULL;
|
||||||
void gl::initModuleGl() {
|
void gl::initModuleGl() {
|
||||||
static std::once_flag once;
|
static std::once_flag once;
|
||||||
std::call_once(once, [] {
|
std::call_once(once, [] {
|
||||||
#if defined(Q_OS_ANDROID)
|
#if defined(HIFI_GLES)
|
||||||
glQueryCounterEXT = (PFNGLQUERYCOUNTEREXTPROC)eglGetProcAddress("glQueryCounterEXT");
|
glQueryCounterEXT = (PFNGLQUERYCOUNTEREXTPROC)eglGetProcAddress("glQueryCounterEXT");
|
||||||
glGetQueryObjectui64vEXT = (PFNGLGETQUERYOBJECTUI64VEXTPROC)eglGetProcAddress("glGetQueryObjectui64vEXT");
|
glGetQueryObjectui64vEXT = (PFNGLGETQUERYOBJECTUI64VEXTPROC)eglGetProcAddress("glGetQueryObjectui64vEXT");
|
||||||
glFramebufferTextureEXT = (PFNGLFRAMEBUFFERTEXTUREEXTPROC)eglGetProcAddress("glFramebufferTextureEXT");
|
glFramebufferTextureEXT = (PFNGLFRAMEBUFFERTEXTUREEXTPROC)eglGetProcAddress("glFramebufferTextureEXT");
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
#include <QtCore/QtGlobal>
|
#include <QtCore/QtGlobal>
|
||||||
|
|
||||||
#if defined(Q_OS_ANDROID)
|
#if defined(USE_GLES)
|
||||||
#define HIFI_GLES
|
#define HIFI_GLES
|
||||||
#define HIFI_EGL
|
#define HIFI_EGL
|
||||||
#endif
|
#endif
|
||||||
|
@ -36,11 +36,11 @@
|
||||||
#define MINIMUM_GL_VERSION ((GL_MIN_VERSION_MAJOR << 8) | GL_MIN_VERSION_MINOR)
|
#define MINIMUM_GL_VERSION ((GL_MIN_VERSION_MAJOR << 8) | GL_MIN_VERSION_MINOR)
|
||||||
|
|
||||||
#if defined(HIFI_GLES)
|
#if defined(HIFI_GLES)
|
||||||
|
#define GL_GLEXT_PROTOTYPES
|
||||||
#include <EGL/egl.h>
|
#include <EGL/egl.h>
|
||||||
#endif
|
#include <GLES3/gl3.h>
|
||||||
|
#include <GLES3/gl3ext.h>
|
||||||
#if defined(HIFI_GLES)
|
#include <GLES3/gl3platform.h>
|
||||||
#include <GLES3/gl32.h>
|
|
||||||
|
|
||||||
#define GL_DEPTH_COMPONENT32_OES 0x81A7
|
#define GL_DEPTH_COMPONENT32_OES 0x81A7
|
||||||
#define GL_TIME_ELAPSED_EXT 0x88BF
|
#define GL_TIME_ELAPSED_EXT 0x88BF
|
||||||
|
|
|
@ -69,7 +69,7 @@ Context::Context(QWindow* window) {
|
||||||
setWindow(window);
|
setWindow(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef GL_CUSTOM_CONTEXT
|
||||||
void Context::destroyWin32Context(HGLRC hglrc) {
|
void Context::destroyWin32Context(HGLRC hglrc) {
|
||||||
wglDeleteContext(hglrc);
|
wglDeleteContext(hglrc);
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ void Context::destroyWin32Context(HGLRC hglrc) {
|
||||||
|
|
||||||
void Context::release() {
|
void Context::release() {
|
||||||
doneCurrent();
|
doneCurrent();
|
||||||
#ifdef Q_OS_WIN
|
#ifdef GL_CUSTOM_CONTEXT
|
||||||
if (_wrappedContext) {
|
if (_wrappedContext) {
|
||||||
destroyContext(_wrappedContext);
|
destroyContext(_wrappedContext);
|
||||||
_wrappedContext = nullptr;
|
_wrappedContext = nullptr;
|
||||||
|
@ -123,14 +123,37 @@ void Context::setWindow(QWindow* window) {
|
||||||
release();
|
release();
|
||||||
_window = window;
|
_window = window;
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef GL_CUSTOM_CONTEXT
|
||||||
_hwnd = (HWND)window->winId();
|
_hwnd = (HWND)window->winId();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
updateSwapchainMemoryCounter();
|
updateSwapchainMemoryCounter();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
|
#ifndef GLAPIENTRY
|
||||||
|
#define GLAPIENTRY GL_APIENTRY
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void GLAPIENTRY debugMessageCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const void* userParam) {
|
||||||
|
//if (GL_DEBUG_SEVERITY_NOTIFICATION == severity) {
|
||||||
|
// return;
|
||||||
|
//}
|
||||||
|
qCDebug(glLogging) << "OpenGL: " << message;
|
||||||
|
|
||||||
|
// For high severity errors, force a sync to the log, since we might crash
|
||||||
|
// before the log file was flushed otherwise. Performance hit here
|
||||||
|
//if (GL_DEBUG_SEVERITY_HIGH == severity) {
|
||||||
|
// AbstractLoggerInterface* logger = AbstractLoggerInterface::get();
|
||||||
|
// if (logger) {
|
||||||
|
// // FIXME find a way to force the log file to sync that doesn't lead to a deadlock
|
||||||
|
// // logger->sync();
|
||||||
|
// }
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(GL_CUSTOM_CONTEXT)
|
||||||
|
|
||||||
bool Context::makeCurrent() {
|
bool Context::makeCurrent() {
|
||||||
BOOL result = wglMakeCurrent(_hdc, _hglrc);
|
BOOL result = wglMakeCurrent(_hdc, _hglrc);
|
||||||
|
@ -148,47 +171,30 @@ void Context::doneCurrent() {
|
||||||
wglMakeCurrent(0, 0);
|
wglMakeCurrent(0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLAPIENTRY debugMessageCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const void* userParam) {
|
|
||||||
if (GL_DEBUG_SEVERITY_NOTIFICATION == severity) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
qCDebug(glLogging) << "OpenGL: " << message;
|
|
||||||
|
|
||||||
// For high severity errors, force a sync to the log, since we might crash
|
|
||||||
// before the log file was flushed otherwise. Performance hit here
|
|
||||||
if (GL_DEBUG_SEVERITY_HIGH == severity) {
|
|
||||||
AbstractLoggerInterface* logger = AbstractLoggerInterface::get();
|
|
||||||
if (logger) {
|
|
||||||
// FIXME find a way to force the log file to sync that doesn't lead to a deadlock
|
|
||||||
// logger->sync();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME build the PFD based on the
|
|
||||||
static const PIXELFORMATDESCRIPTOR pfd = // pfd Tells Windows How We Want Things To Be
|
|
||||||
{
|
|
||||||
sizeof(PIXELFORMATDESCRIPTOR), // Size Of This Pixel Format Descriptor
|
|
||||||
1, // Version Number
|
|
||||||
PFD_DRAW_TO_WINDOW | // Format Must Support Window
|
|
||||||
PFD_SUPPORT_OPENGL | // Format Must Support OpenGL
|
|
||||||
PFD_DOUBLEBUFFER, // Must Support Double Buffering
|
|
||||||
PFD_TYPE_RGBA, // Request An RGBA Format
|
|
||||||
24, // Select Our Color Depth
|
|
||||||
0, 0, 0, 0, 0, 0, // Color Bits Ignored
|
|
||||||
1, // Alpha Buffer
|
|
||||||
0, // Shift Bit Ignored
|
|
||||||
0, // No Accumulation Buffer
|
|
||||||
0, 0, 0, 0, // Accumulation Bits Ignored
|
|
||||||
24, // 24 Bit Z-Buffer (Depth Buffer)
|
|
||||||
8, // 8 Bit Stencil Buffer
|
|
||||||
0, // No Auxiliary Buffer
|
|
||||||
PFD_MAIN_PLANE, // Main Drawing Layer
|
|
||||||
0, // Reserved
|
|
||||||
0, 0, 0 // Layer Masks Ignored
|
|
||||||
};
|
|
||||||
|
|
||||||
void setupPixelFormatSimple(HDC hdc) {
|
void setupPixelFormatSimple(HDC hdc) {
|
||||||
|
// FIXME build the PFD based on the
|
||||||
|
static const PIXELFORMATDESCRIPTOR pfd = // pfd Tells Windows How We Want Things To Be
|
||||||
|
{
|
||||||
|
sizeof(PIXELFORMATDESCRIPTOR), // Size Of This Pixel Format Descriptor
|
||||||
|
1, // Version Number
|
||||||
|
PFD_DRAW_TO_WINDOW | // Format Must Support Window
|
||||||
|
PFD_SUPPORT_OPENGL | // Format Must Support OpenGL
|
||||||
|
PFD_DOUBLEBUFFER, // Must Support Double Buffering
|
||||||
|
PFD_TYPE_RGBA, // Request An RGBA Format
|
||||||
|
24, // Select Our Color Depth
|
||||||
|
0, 0, 0, 0, 0, 0, // Color Bits Ignored
|
||||||
|
1, // Alpha Buffer
|
||||||
|
0, // Shift Bit Ignored
|
||||||
|
0, // No Accumulation Buffer
|
||||||
|
0, 0, 0, 0, // Accumulation Bits Ignored
|
||||||
|
24, // 24 Bit Z-Buffer (Depth Buffer)
|
||||||
|
8, // 8 Bit Stencil Buffer
|
||||||
|
0, // No Auxiliary Buffer
|
||||||
|
PFD_MAIN_PLANE, // Main Drawing Layer
|
||||||
|
0, // Reserved
|
||||||
|
0, 0, 0 // Layer Masks Ignored
|
||||||
|
};
|
||||||
auto pixelFormat = ChoosePixelFormat(hdc, &pfd);
|
auto pixelFormat = ChoosePixelFormat(hdc, &pfd);
|
||||||
if (pixelFormat == 0) {
|
if (pixelFormat == 0) {
|
||||||
throw std::runtime_error("Unable to create initial context");
|
throw std::runtime_error("Unable to create initial context");
|
||||||
|
@ -314,6 +320,7 @@ void Context::create() {
|
||||||
doneCurrent();
|
doneCurrent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void Context::clear() {
|
void Context::clear() {
|
||||||
|
|
|
@ -22,6 +22,9 @@ class QWindow;
|
||||||
class QOpenGLContext;
|
class QOpenGLContext;
|
||||||
class QThread;
|
class QThread;
|
||||||
|
|
||||||
|
#if defined(Q_OS_WIN) && !defined(USE_GLES)
|
||||||
|
#define GL_CUSTOM_CONTEXT
|
||||||
|
#endif
|
||||||
namespace gl {
|
namespace gl {
|
||||||
|
|
||||||
class Context {
|
class Context {
|
||||||
|
@ -29,7 +32,7 @@ namespace gl {
|
||||||
QWindow* _window { nullptr };
|
QWindow* _window { nullptr };
|
||||||
static Context* PRIMARY;
|
static Context* PRIMARY;
|
||||||
static void destroyContext(QOpenGLContext* context);
|
static void destroyContext(QOpenGLContext* context);
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(GL_CUSTOM_CONTEXT)
|
||||||
uint32_t _version { 0x0401 };
|
uint32_t _version { 0x0401 };
|
||||||
HWND _hwnd { 0 };
|
HWND _hwnd { 0 };
|
||||||
HDC _hdc { 0 };
|
HDC _hdc { 0 };
|
||||||
|
|
|
@ -28,7 +28,7 @@ void Context::makeCurrent(QOpenGLContext* context, QSurface* surface) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QOpenGLContext* Context::qglContext() {
|
QOpenGLContext* Context::qglContext() {
|
||||||
#ifdef Q_OS_WIN
|
#ifdef GL_CUSTOM_CONTEXT
|
||||||
if (!_wrappedContext) {
|
if (!_wrappedContext) {
|
||||||
_wrappedContext = new QOpenGLContext();
|
_wrappedContext = new QOpenGLContext();
|
||||||
_wrappedContext->setNativeHandle(QVariant::fromValue(QWGLNativeContext(_hglrc, _hwnd)));
|
_wrappedContext->setNativeHandle(QVariant::fromValue(QWGLNativeContext(_hglrc, _hwnd)));
|
||||||
|
@ -45,7 +45,7 @@ void Context::moveToThread(QThread* thread) {
|
||||||
qglContext()->moveToThread(thread);
|
qglContext()->moveToThread(thread);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef Q_OS_WIN
|
#ifndef GL_CUSTOM_CONTEXT
|
||||||
bool Context::makeCurrent() {
|
bool Context::makeCurrent() {
|
||||||
updateSwapchainMemoryCounter();
|
updateSwapchainMemoryCounter();
|
||||||
return _context->makeCurrent(_window);
|
return _context->makeCurrent(_window);
|
||||||
|
|
|
@ -28,18 +28,19 @@ const QSurfaceFormat& getDefaultOpenGLSurfaceFormat() {
|
||||||
static QSurfaceFormat format;
|
static QSurfaceFormat format;
|
||||||
static std::once_flag once;
|
static std::once_flag once;
|
||||||
std::call_once(once, [] {
|
std::call_once(once, [] {
|
||||||
#if defined(HIFI_GLES)
|
#if defined(USE_GLES)
|
||||||
format.setRenderableType(QSurfaceFormat::OpenGLES);
|
format.setRenderableType(QSurfaceFormat::OpenGLES);
|
||||||
format.setRedBufferSize(8);
|
format.setRedBufferSize(8);
|
||||||
format.setGreenBufferSize(8);
|
format.setGreenBufferSize(8);
|
||||||
format.setBlueBufferSize(8);
|
format.setBlueBufferSize(8);
|
||||||
format.setAlphaBufferSize(8);
|
format.setAlphaBufferSize(8);
|
||||||
|
#else
|
||||||
|
format.setProfile(QSurfaceFormat::OpenGLContextProfile::CoreProfile);
|
||||||
#endif
|
#endif
|
||||||
// Qt Quick may need a depth and stencil buffer. Always make sure these are available.
|
// Qt Quick may need a depth and stencil buffer. Always make sure these are available.
|
||||||
format.setDepthBufferSize(DEFAULT_GL_DEPTH_BUFFER_BITS);
|
format.setDepthBufferSize(DEFAULT_GL_DEPTH_BUFFER_BITS);
|
||||||
format.setStencilBufferSize(DEFAULT_GL_STENCIL_BUFFER_BITS);
|
format.setStencilBufferSize(DEFAULT_GL_STENCIL_BUFFER_BITS);
|
||||||
setGLFormatVersion(format);
|
setGLFormatVersion(format);
|
||||||
format.setProfile(QSurfaceFormat::OpenGLContextProfile::CoreProfile);
|
|
||||||
QSurfaceFormat::setDefaultFormat(format);
|
QSurfaceFormat::setDefaultFormat(format);
|
||||||
});
|
});
|
||||||
return format;
|
return format;
|
||||||
|
|
|
@ -26,7 +26,7 @@ class QGLFormat;
|
||||||
|
|
||||||
template<class F>
|
template<class F>
|
||||||
// https://bugreports.qt.io/browse/QTBUG-64703 prevents us from using "defined(QT_OPENGL_ES_3_1)"
|
// https://bugreports.qt.io/browse/QTBUG-64703 prevents us from using "defined(QT_OPENGL_ES_3_1)"
|
||||||
#if defined(Q_OS_ANDROID)
|
#if defined(USE_GLES)
|
||||||
void setGLFormatVersion(F& format, int major = 3, int minor = 2)
|
void setGLFormatVersion(F& format, int major = 3, int minor = 2)
|
||||||
#else
|
#else
|
||||||
void setGLFormatVersion(F& format, int major = 4, int minor = 5)
|
void setGLFormatVersion(F& format, int major = 4, int minor = 5)
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
# See the accompanying file LICENSE or http:#www.apache.org/licenses/LICENSE-2.0.html
|
# See the accompanying file LICENSE or http:#www.apache.org/licenses/LICENSE-2.0.html
|
||||||
#
|
#
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32 AND (NOT USE_GLES))
|
||||||
|
|
||||||
# we're using static GLEW, so define GLEW_STATIC
|
# we're using static GLEW, so define GLEW_STATIC
|
||||||
add_definitions(-DGLEW_STATIC)
|
add_definitions(-DGLEW_STATIC)
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
# See the accompanying file LICENSE or http:#www.apache.org/licenses/LICENSE-2.0.html
|
# See the accompanying file LICENSE or http:#www.apache.org/licenses/LICENSE-2.0.html
|
||||||
#
|
#
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32 AND (NOT USE_GLES))
|
||||||
# we're using static GLEW, so define GLEW_STATIC
|
# we're using static GLEW, so define GLEW_STATIC
|
||||||
add_definitions(-DGLEW_STATIC)
|
add_definitions(-DGLEW_STATIC)
|
||||||
set(TARGET_NAME openvr)
|
set(TARGET_NAME openvr)
|
||||||
|
|
Loading…
Reference in a new issue