From 77b45e2b4adbba05f32e5d77092545cd6f033ad0 Mon Sep 17 00:00:00 2001 From: Brad Davis Date: Fri, 29 May 2015 12:59:55 -0700 Subject: [PATCH] Adding missing files --- libraries/shared/src/GLHelpers.cpp | 16 ++++++++++++++++ libraries/shared/src/GLHelpers.h | 23 +++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 libraries/shared/src/GLHelpers.cpp create mode 100644 libraries/shared/src/GLHelpers.h diff --git a/libraries/shared/src/GLHelpers.cpp b/libraries/shared/src/GLHelpers.cpp new file mode 100644 index 0000000000..f2371e49bb --- /dev/null +++ b/libraries/shared/src/GLHelpers.cpp @@ -0,0 +1,16 @@ +#include "GLHelpers.h" + + +QSurfaceFormat getDefaultOpenGlSurfaceFormat() { + QSurfaceFormat format; + // Qt Quick may need a depth and stencil buffer. Always make sure these are available. + format.setDepthBufferSize(DEFAULT_GL_DEPTH_BUFFER_BITS); + format.setStencilBufferSize(DEFAULT_GL_STENCIL_BUFFER_BITS); + format.setVersion(4, 1); +#ifdef DEBUG + format.setOption(QSurfaceFormat::DebugContext); +#endif + // FIXME move to core as soon as possible + format.setProfile(QSurfaceFormat::OpenGLContextProfile::CompatibilityProfile); + return format; +} diff --git a/libraries/shared/src/GLHelpers.h b/libraries/shared/src/GLHelpers.h new file mode 100644 index 0000000000..dc9f0f3140 --- /dev/null +++ b/libraries/shared/src/GLHelpers.h @@ -0,0 +1,23 @@ +// +// Created by Bradley Austin Davis 2015/05/29 +// Copyright 2014 High Fidelity, Inc. +// +// Distributed under the Apache License, Version 2.0. +// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html +// + +#pragma once +#ifndef hifi_GLHelpers_h +#define hifi_GLHelpers_h + +#include + +// 16 bits of depth precision +#define DEFAULT_GL_DEPTH_BUFFER_BITS 16 +// 8 bits of stencil buffer (typically you really only need 1 bit for functionality +// but GL implementations usually just come with buffer sizes in multiples of 8) +#define DEFAULT_GL_STENCIL_BUFFER_BITS 8 + +QSurfaceFormat getDefaultOpenGlSurfaceFormat(); + +#endif