Merge remote-tracking branch 'upstream/master' into plugins

Conflicts:
	interface/src/devices/OculusManager.cpp
	interface/src/devices/TV3DManager.cpp
	interface/src/devices/TV3DManager.h
	libraries/gpu/src/gpu/GPUConfig.h
This commit is contained in:
Brad Davis 2015-07-31 10:28:06 -07:00
commit 155f88e267
30 changed files with 204 additions and 208 deletions

View file

@ -38,5 +38,19 @@ if (WIN32)
find_package_handle_standard_args(GLEW DEFAULT_MSG GLEW_INCLUDE_DIRS GLEW_LIBRARIES GLEW_DLL_PATH) find_package_handle_standard_args(GLEW DEFAULT_MSG GLEW_INCLUDE_DIRS GLEW_LIBRARIES GLEW_DLL_PATH)
add_paths_to_fixup_libs(${GLEW_DLL_PATH}) add_paths_to_fixup_libs(${GLEW_DLL_PATH})
elseif (APPLE)
else ()
find_path(GLEW_INCLUDE_DIR GL/glew.h)
find_library(GLEW_LIBRARY NAMES GLEW glew32 glew glew32s PATH_SUFFIXES lib64)
set(GLEW_INCLUDE_DIRS ${GLEW_INCLUDE_DIR})
set(GLEW_LIBRARIES ${GLEW_LIBRARY})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GLEW
REQUIRED_VARS GLEW_INCLUDE_DIR GLEW_LIBRARY)
mark_as_advanced(GLEW_INCLUDE_DIR GLEW_LIBRARY)
endif () endif ()

View file

@ -208,33 +208,13 @@ else (APPLE)
"${PROJECT_SOURCE_DIR}/resources" "${PROJECT_SOURCE_DIR}/resources"
$<TARGET_FILE_DIR:${TARGET_NAME}>/resources $<TARGET_FILE_DIR:${TARGET_NAME}>/resources
) )
find_package(OpenGL REQUIRED)
if (${OPENGL_INCLUDE_DIR})
include_directories(SYSTEM "${OPENGL_INCLUDE_DIR}")
endif ()
target_link_libraries(${TARGET_NAME} "${OPENGL_LIBRARY}")
# link target to external libraries # link target to external libraries
if (WIN32) if (WIN32)
add_dependency_external_projects(glew) # target_link_libraries(${TARGET_NAME} wsock32.lib Winmm.lib)
find_package(GLEW REQUIRED) target_link_libraries(${TARGET_NAME} wsock32.lib Winmm.lib)
target_include_directories(${TARGET_NAME} PRIVATE ${GLEW_INCLUDE_DIRS}) else (WIN32)
# Nothing else required on linux apparently
target_link_libraries(${TARGET_NAME} ${GLEW_LIBRARIES} wsock32.lib opengl32.lib Winmm.lib)
if (USE_NSIGHT)
# try to find the Nsight package and add it to the build if we find it
find_package(NSIGHT)
if (NSIGHT_FOUND)
include_directories(${NSIGHT_INCLUDE_DIRS})
add_definitions(-DNSIGHT_FOUND)
target_link_libraries(${TARGET_NAME} "${NSIGHT_LIBRARIES}")
endif ()
endif()
endif() endif()
endif (APPLE) endif (APPLE)

View file

@ -797,8 +797,9 @@ void Application::initializeGL() {
} }
#endif #endif
// Where the gpuContext is created and where the TRUE Backend is created and assigned // Where the gpuContext is initialized and where the TRUE Backend is created and assigned
_gpuContext = std::make_shared<gpu::Context>(new gpu::GLBackend()); gpu::Context::init<gpu::GLBackend>();
_gpuContext = std::make_shared<gpu::Context>();
initDisplay(); initDisplay();
qCDebug(interfaceapp, "Initialized Display."); qCDebug(interfaceapp, "Initialized Display.");

View file

@ -14,8 +14,6 @@
#include <mutex> #include <mutex>
#include <QElapsedTimer> #include <QElapsedTimer>
#include <gpu/GPUConfig.h>
#include <gpu/Batch.h>
#include <gpu/Context.h> #include <gpu/Context.h>
#include <NumericalConstants.h> #include <NumericalConstants.h>
#include <DependencyManager.h> #include <DependencyManager.h>
@ -208,8 +206,6 @@ void Stars::render(RenderArgs* renderArgs, float alpha) {
batch._glUniform1f(_timeSlot, secs); batch._glUniform1f(_timeSlot, secs);
geometryCache->renderUnitCube(batch); geometryCache->renderUnitCube(batch);
glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
static const size_t VERTEX_STRIDE = sizeof(StarVertex); static const size_t VERTEX_STRIDE = sizeof(StarVertex);
size_t offset = offsetof(StarVertex, position); size_t offset = offsetof(StarVertex, position);
gpu::BufferView posView(vertexBuffer, offset, vertexBuffer->getSize(), VERTEX_STRIDE, positionElement); gpu::BufferView posView(vertexBuffer, offset, vertexBuffer->getSize(), VERTEX_STRIDE, positionElement);
@ -218,10 +214,11 @@ void Stars::render(RenderArgs* renderArgs, float alpha) {
// Render the stars // Render the stars
batch.setPipeline(_starsPipeline); batch.setPipeline(_starsPipeline);
batch.setInputFormat(streamFormat); batch.setInputFormat(streamFormat);
batch.setInputBuffer(VERTICES_SLOT, posView); batch.setInputBuffer(VERTICES_SLOT, posView);
batch.setInputBuffer(COLOR_SLOT, colView); batch.setInputBuffer(COLOR_SLOT, colView);
batch.draw(gpu::Primitive::POINTS, STARFIELD_NUM_STARS); batch.draw(gpu::Primitive::POINTS, STARFIELD_NUM_STARS);
renderArgs->_context->render(batch); renderArgs->_context->render(batch);
} }

View file

@ -35,7 +35,7 @@
#include <PolyVoxCore/Material.h> #include <PolyVoxCore/Material.h>
#include "model/Geometry.h" #include "model/Geometry.h"
#include "gpu/GLBackend.h" #include "gpu/Context.h"
#include "EntityTreeRenderer.h" #include "EntityTreeRenderer.h"
#include "RenderablePolyVoxEntityItem.h" #include "RenderablePolyVoxEntityItem.h"

View file

@ -8,7 +8,6 @@
#include "RenderableWebEntityItem.h" #include "RenderableWebEntityItem.h"
#include <gpu/GPUConfig.h>
#include <QMouseEvent> #include <QMouseEvent>
#include <QQuickItem> #include <QQuickItem>
#include <QQuickWindow> #include <QQuickWindow>
@ -24,7 +23,7 @@
#include <GLMHelpers.h> #include <GLMHelpers.h>
#include <PathUtils.h> #include <PathUtils.h>
#include <TextureCache.h> #include <TextureCache.h>
#include <gpu/GLBackend.h> #include <gpu/Context.h>
#include "EntityTreeRenderer.h" #include "EntityTreeRenderer.h"

View file

@ -155,9 +155,9 @@ void ParticleEffectEntityItem::computeAndUpdateDimensions() {
float yMin = std::min(yApex, yEnd); float yMin = std::min(yApex, yEnd);
// times 2 because dimensions are diameters not radii. // times 2 because dimensions are diameters not radii.
glm::vec3 dims(2.0f * std::max(fabs(xMin), fabs(xMax)), glm::vec3 dims(2.0f * std::max(fabsf(xMin), fabsf(xMax)),
2.0f * std::max(fabs(yMin), fabs(yMax)), 2.0f * std::max(fabsf(yMin), fabsf(yMax)),
2.0f * std::max(fabs(zMin), fabs(zMax))); 2.0f * std::max(fabsf(zMin), fabsf(zMax)));
EntityItem::setDimensions(dims); EntityItem::setDimensions(dims);
} }

View file

@ -21,23 +21,26 @@ elseif (WIN32)
if (USE_NSIGHT) if (USE_NSIGHT)
# try to find the Nsight package and add it to the build if we find it # try to find the Nsight package and add it to the build if we find it
# note that this will also enable NSIGHT profilers in all the projects linking gpu
find_package(NSIGHT) find_package(NSIGHT)
if (NSIGHT_FOUND) if (NSIGHT_FOUND)
include_directories(${NSIGHT_INCLUDE_DIRS}) target_include_directories(${TARGET_NAME} PUBLIC ${NSIGHT_INCLUDE_DIRS})
add_definitions(-DNSIGHT_FOUND) target_compile_definitions(${TARGET_NAME} PUBLIC NSIGHT_FOUND)
target_link_libraries(${TARGET_NAME} "${NSIGHT_LIBRARIES}") target_link_libraries(${TARGET_NAME} "${NSIGHT_LIBRARIES}")
endif () endif ()
endif() endif()
elseif (ANDROID) elseif (ANDROID)
target_link_libraries(${TARGET_NAME} "-lGLESv3" "-lEGL") target_link_libraries(${TARGET_NAME} "-lGLESv3" "-lEGL")
else () else ()
find_package(GLEW REQUIRED)
target_include_directories(${TARGET_NAME} PUBLIC ${GLEW_INCLUDE_DIRS})
find_package(OpenGL REQUIRED) find_package(OpenGL REQUIRED)
if (${OPENGL_INCLUDE_DIR}) if (${OPENGL_INCLUDE_DIR})
include_directories(SYSTEM "${OPENGL_INCLUDE_DIR}") include_directories(SYSTEM "${OPENGL_INCLUDE_DIR}")
endif () endif ()
target_link_libraries(${TARGET_NAME} "${OPENGL_LIBRARY}") target_link_libraries(${TARGET_NAME} "${GLEW_LIBRARIES}" "${OPENGL_LIBRARY}")
target_include_directories(${TARGET_NAME} PUBLIC ${OPENGL_INCLUDE_DIR})
endif (APPLE) endif (APPLE)

View file

@ -8,13 +8,9 @@
// Distributed under the Apache License, Version 2.0. // Distributed under the Apache License, Version 2.0.
// 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
// //
#include <string.h>
#include "Batch.h" #include "Batch.h"
#include "GPUConfig.h"
#include <QDebug>
#include <GLMHelpers.h>
#if defined(NSIGHT_FOUND) #if defined(NSIGHT_FOUND)
#include "nvToolsExt.h" #include "nvToolsExt.h"
@ -292,15 +288,3 @@ void Batch::resetStages() {
ADD_COMMAND(resetStages); ADD_COMMAND(resetStages);
} }
void push_back(Batch::Params& params, const vec3& v) {
params.push_back(v.x);
params.push_back(v.y);
params.push_back(v.z);
}
void push_back(Batch::Params& params, const vec4& v) {
params.push_back(v.x);
params.push_back(v.y);
params.push_back(v.z);
params.push_back(v.a);
}

View file

@ -21,10 +21,9 @@
<@def VERSION_HEADER #version 120 <@def VERSION_HEADER #version 120
#extension GL_EXT_gpu_shader4 : enable@> #extension GL_EXT_gpu_shader4 : enable@>
<@else@> <@else@>
<@def GPU_FEATURE_PROFILE GPU_LEGACY@> <@def GPU_FEATURE_PROFILE GPU_CORE@>
<@def GPU_TRANSFORM_PROFILE GPU_LEGACY@> <@def GPU_TRANSFORM_PROFILE GPU_CORE@>
<@def VERSION_HEADER #version 120 <@def VERSION_HEADER #version 430 compatibility@>
#extension GL_EXT_gpu_shader4 : enable@>
<@endif@> <@endif@>
<@endif@> <@endif@>

View file

@ -10,13 +10,16 @@
// //
#include "Context.h" #include "Context.h"
// this include should disappear! as soon as the gpu::Context is in place
#include "GLBackend.h"
using namespace gpu; using namespace gpu;
Context::Context(Backend* backend) : Context::CreateBackend Context::_createBackendCallback = nullptr;
_backend(backend) { Context::MakeProgram Context::_makeProgramCallback = nullptr;
std::once_flag Context::_initialized;
Context::Context() {
if (_createBackendCallback) {
_backend.reset(_createBackendCallback());
}
} }
Context::Context(const Context& context) { Context::Context(const Context& context) {
@ -26,8 +29,8 @@ Context::~Context() {
} }
bool Context::makeProgram(Shader& shader, const Shader::BindingSet& bindings) { bool Context::makeProgram(Shader& shader, const Shader::BindingSet& bindings) {
if (shader.isProgram()) { if (shader.isProgram() && _makeProgramCallback) {
return GLBackend::makeProgram(shader, bindings); return _makeProgramCallback(shader, bindings);
} }
return false; return false;
} }

View file

@ -12,6 +12,7 @@
#define hifi_gpu_Context_h #define hifi_gpu_Context_h
#include <assert.h> #include <assert.h>
#include <mutex>
#include "Batch.h" #include "Batch.h"
@ -26,13 +27,12 @@ namespace gpu {
class Backend { class Backend {
public: public:
virtual~ Backend() {}; virtual~ Backend() {};
virtual void render(Batch& batch) = 0; virtual void render(Batch& batch) = 0;
virtual void syncCache() = 0; virtual void syncCache() = 0;
virtual void downloadFramebuffer(const FramebufferPointer& srcFramebuffer, const Vec4i& region, QImage& destImage) = 0; virtual void downloadFramebuffer(const FramebufferPointer& srcFramebuffer, const Vec4i& region, QImage& destImage) = 0;
class TransformObject { class TransformObject {
public: public:
Mat4 _model; Mat4 _model;
@ -118,7 +118,21 @@ protected:
class Context { class Context {
public: public:
Context(Backend* backend); typedef Backend* (*CreateBackend)();
typedef bool (*MakeProgram)(Shader& shader, const Shader::BindingSet& bindings);
// This one call must happen before any context is created or used (Shader::MakeProgram) in order to setup the Backend and any singleton data needed
template <class T>
static void init() {
std::call_once(_initialized, [] {
_createBackendCallback = T::createBackend;
_makeProgramCallback = T::makeProgram;
T::init();
});
}
Context();
~Context(); ~Context();
void render(Batch& batch); void render(Batch& batch);
@ -132,13 +146,17 @@ public:
protected: protected:
Context(const Context& context); Context(const Context& context);
std::unique_ptr<Backend> _backend;
// This function can only be called by "static Shader::makeProgram()" // This function can only be called by "static Shader::makeProgram()"
// makeProgramShader(...) make a program shader ready to be used in a Batch. // makeProgramShader(...) make a program shader ready to be used in a Batch.
// It compiles the sub shaders, link them and defines the Slots and their bindings. // It compiles the sub shaders, link them and defines the Slots and their bindings.
// If the shader passed is not a program, nothing happens. // If the shader passed is not a program, nothing happens.
static bool makeProgram(Shader& shader, const Shader::BindingSet& bindings = Shader::BindingSet()); static bool makeProgram(Shader& shader, const Shader::BindingSet& bindings);
std::unique_ptr<Backend> _backend; static CreateBackend _createBackendCallback;
static MakeProgram _makeProgramCallback;
static std::once_flag _initialized;
friend class Shader; friend class Shader;
}; };

View file

@ -8,9 +8,9 @@
// Distributed under the Apache License, Version 2.0. // Distributed under the Apache License, Version 2.0.
// 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
// //
#include <mutex>
#include "GPULogging.h"
#include "GLBackendShared.h" #include "GLBackendShared.h"
#include <mutex>
#include <glm/gtc/type_ptr.hpp> #include <glm/gtc/type_ptr.hpp>
using namespace gpu; using namespace gpu;
@ -63,12 +63,7 @@ GLBackend::CommandCall GLBackend::_commandCalls[Batch::NUM_COMMANDS] =
(&::gpu::GLBackend::do_glLineWidth), (&::gpu::GLBackend::do_glLineWidth),
}; };
GLBackend::GLBackend() : void GLBackend::init() {
_input(),
_transform(),
_pipeline(),
_output()
{
static std::once_flag once; static std::once_flag once;
std::call_once(once, [] { std::call_once(once, [] {
qCDebug(gpulogging) << "GL Version: " << QString((const char*) glGetString(GL_VERSION)); qCDebug(gpulogging) << "GL Version: " << QString((const char*) glGetString(GL_VERSION));
@ -94,6 +89,13 @@ GLBackend::GLBackend() :
#endif #endif
#if defined(Q_OS_LINUX) #if defined(Q_OS_LINUX)
GLenum err = glewInit();
if (GLEW_OK != err) {
/* Problem: glewInit failed, something is seriously wrong. */
qCDebug(gpulogging, "Error: %s\n", glewGetErrorString(err));
}
qCDebug(gpulogging, "Status: Using GLEW %s\n", glewGetString(GLEW_VERSION));
// TODO: Write the correct code for Linux... // TODO: Write the correct code for Linux...
/* if (wglewGetExtension("WGL_EXT_swap_control")) { /* if (wglewGetExtension("WGL_EXT_swap_control")) {
int swapInterval = wglGetSwapIntervalEXT(); int swapInterval = wglGetSwapIntervalEXT();
@ -101,7 +103,18 @@ GLBackend::GLBackend() :
}*/ }*/
#endif #endif
}); });
}
Backend* GLBackend::createBackend() {
return new GLBackend();
}
GLBackend::GLBackend() :
_input(),
_transform(),
_pipeline(),
_output()
{
initInput(); initInput();
initTransform(); initTransform();
} }

View file

@ -18,16 +18,21 @@
#include "GPUConfig.h" #include "GPUConfig.h"
#include "Context.h" #include "Context.h"
#include "Batch.h"
namespace gpu { namespace gpu {
class GLBackend : public Backend { class GLBackend : public Backend {
public:
// Context Backend static interface required
friend class Context;
static void init();
static Backend* createBackend();
static bool makeProgram(Shader& shader, const Shader::BindingSet& bindings);
explicit GLBackend(bool syncCache); explicit GLBackend(bool syncCache);
GLBackend(); GLBackend();
public:
virtual ~GLBackend(); virtual ~GLBackend();
virtual void render(Batch& batch); virtual void render(Batch& batch);
@ -49,7 +54,6 @@ public:
static void checkGLStackStable(std::function<void()> f); static void checkGLStackStable(std::function<void()> f);
static bool makeProgram(Shader& shader, const Shader::BindingSet& bindings = Shader::BindingSet());
class GLBuffer : public GPUObject { class GLBuffer : public GPUObject {
@ -91,9 +95,9 @@ public:
#if (GPU_TRANSFORM_PROFILE == GPU_CORE) #if (GPU_TRANSFORM_PROFILE == GPU_CORE)
#else #else
GLuint _transformObject_model = -1; GLint _transformObject_model = -1;
GLuint _transformCamera_viewInverse = -1; GLint _transformCamera_viewInverse = -1;
GLuint _transformCamera_viewport = -1; GLint _transformCamera_viewport = -1;
#endif #endif
GLShader(); GLShader();

View file

@ -8,7 +8,6 @@
// Distributed under the Apache License, Version 2.0. // Distributed under the Apache License, Version 2.0.
// 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
// //
#include "GPULogging.h"
#include "GLBackendShared.h" #include "GLBackendShared.h"

View file

@ -8,7 +8,6 @@
// Distributed under the Apache License, Version 2.0. // Distributed under the Apache License, Version 2.0.
// 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
// //
#include "GPULogging.h"
#include "GLBackendShared.h" #include "GLBackendShared.h"
#include "Format.h" #include "Format.h"
@ -542,7 +541,12 @@ ElementResource getFormatFromGLUniform(GLenum gltype) {
}; };
int makeUniformSlots(GLuint glprogram, const Shader::BindingSet& slotBindings, Shader::SlotSet& uniforms, Shader::SlotSet& textures, Shader::SlotSet& samplers) { int makeUniformSlots(GLuint glprogram, const Shader::BindingSet& slotBindings,
Shader::SlotSet& uniforms, Shader::SlotSet& textures, Shader::SlotSet& samplers
#if (GPU_FEATURE_PROFILE == GPU_LEGACY)
, Shader::SlotSet& fakeBuffers
#endif
) {
GLint uniformsCount = 0; GLint uniformsCount = 0;
#if (GPU_FEATURE_PROFILE == GPU_LEGACY) #if (GPU_FEATURE_PROFILE == GPU_LEGACY)
@ -583,6 +587,15 @@ int makeUniformSlots(GLuint glprogram, const Shader::BindingSet& slotBindings, S
} }
if (elementResource._resource == Resource::BUFFER) { if (elementResource._resource == Resource::BUFFER) {
#if (GPU_FEATURE_PROFILE == GPU_LEGACY)
// if in legacy profile, we fake the uniform buffer with an array
// this is where we detect it assuming it's explicitely assinged a binding
auto requestedBinding = slotBindings.find(std::string(sname));
if (requestedBinding != slotBindings.end()) {
// found one buffer!
fakeBuffers.insert(Shader::Slot(sname, location, elementResource._element, elementResource._resource));
}
#endif
uniforms.insert(Shader::Slot(sname, location, elementResource._element, elementResource._resource)); uniforms.insert(Shader::Slot(sname, location, elementResource._element, elementResource._resource));
} else { } else {
// For texture/Sampler, the location is the actual binding value // For texture/Sampler, the location is the actual binding value
@ -640,14 +653,13 @@ int makeUniformBlockSlots(GLuint glprogram, const Shader::BindingSet& slotBindin
GLchar name[NAME_LENGTH]; GLchar name[NAME_LENGTH];
GLint length = 0; GLint length = 0;
GLint size = 0; GLint size = 0;
GLenum type = 0;
GLint binding = -1; GLint binding = -1;
glGetActiveUniformBlockiv(glprogram, i, GL_UNIFORM_BLOCK_NAME_LENGTH, &length); glGetActiveUniformBlockiv(glprogram, i, GL_UNIFORM_BLOCK_NAME_LENGTH, &length);
glGetActiveUniformBlockName(glprogram, i, NAME_LENGTH, &length, name); glGetActiveUniformBlockName(glprogram, i, NAME_LENGTH, &length, name);
glGetActiveUniformBlockiv(glprogram, i, GL_UNIFORM_BLOCK_BINDING, &binding); glGetActiveUniformBlockiv(glprogram, i, GL_UNIFORM_BLOCK_BINDING, &binding);
glGetActiveUniformBlockiv(glprogram, i, GL_UNIFORM_BLOCK_DATA_SIZE, &size); glGetActiveUniformBlockiv(glprogram, i, GL_UNIFORM_BLOCK_DATA_SIZE, &size);
GLuint blockIndex = glGetUniformBlockIndex(glprogram, name); GLuint blockIndex = glGetUniformBlockIndex(glprogram, name);
// CHeck if there is a requested binding for this block // CHeck if there is a requested binding for this block
@ -738,8 +750,12 @@ bool GLBackend::makeProgram(Shader& shader, const Shader::BindingSet& slotBindin
Shader::SlotSet uniforms; Shader::SlotSet uniforms;
Shader::SlotSet textures; Shader::SlotSet textures;
Shader::SlotSet samplers; Shader::SlotSet samplers;
#if (GPU_FEATURE_PROFILE == GPU_CORE)
makeUniformSlots(object->_program, slotBindings, uniforms, textures, samplers); makeUniformSlots(object->_program, slotBindings, uniforms, textures, samplers);
#else
makeUniformSlots(object->_program, slotBindings, uniforms, textures, samplers, buffers);
#endif
Shader::SlotSet inputs; Shader::SlotSet inputs;
makeInputSlots(object->_program, slotBindings, inputs); makeInputSlots(object->_program, slotBindings, inputs);

View file

@ -11,11 +11,10 @@
#ifndef hifi_gpu_GLBackend_Shared_h #ifndef hifi_gpu_GLBackend_Shared_h
#define hifi_gpu_GLBackend_Shared_h #define hifi_gpu_GLBackend_Shared_h
#include "GLBackend.h"
#include <QDebug> #include <QDebug>
#include "Batch.h" #include "GPULogging.h"
#include "GLBackend.h"
static const GLenum _primitiveToGLmode[gpu::NUM_PRIMITIVES] = { static const GLenum _primitiveToGLmode[gpu::NUM_PRIMITIVES] = {
GL_POINTS, GL_POINTS,

View file

@ -484,6 +484,7 @@ void GLBackend::syncPipelineStateCache() {
glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS); glEnable(GL_TEXTURE_CUBE_MAP_SEAMLESS);
// Point size is always on // Point size is always on
glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
glEnable(GL_PROGRAM_POINT_SIZE_EXT); glEnable(GL_PROGRAM_POINT_SIZE_EXT);
glEnable(GL_VERTEX_PROGRAM_POINT_SIZE); glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);

View file

@ -37,8 +37,7 @@
#else #else
#include <GL/gl.h> #include <GL/glew.h>
#include <GL/glext.h>
#define GPU_FEATURE_PROFILE GPU_CORE #define GPU_FEATURE_PROFILE GPU_CORE
#define GPU_TRANSFORM_PROFILE GPU_CORE #define GPU_TRANSFORM_PROFILE GPU_CORE

View file

@ -13,13 +13,13 @@
#include <bitset> #include <bitset>
#include <map> #include <map>
#include <qurl.h>
#include <glm/glm.hpp> #include <glm/glm.hpp>
#include "gpu/Resource.h" #include "gpu/Resource.h"
#include "gpu/Texture.h" #include "gpu/Texture.h"
#include <qurl.h>
namespace model { namespace model {

View file

@ -9,15 +9,12 @@
// 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
// //
// include this before QOpenGLFramebufferObject, which includes an earlier version of OpenGL
#include <gpu/GPUConfig.h>
#include <gpu/GLBackend.h>
#include <glm/gtc/random.hpp> #include <glm/gtc/random.hpp>
#include <PathUtils.h> #include <PathUtils.h>
#include <SharedUtil.h> #include <SharedUtil.h>
#include <gpu/Context.h>
#include "gpu/StandardShaderLib.h" #include "gpu/StandardShaderLib.h"
#include "AmbientOcclusionEffect.h" #include "AmbientOcclusionEffect.h"
@ -176,7 +173,6 @@ void AmbientOcclusion::run(const render::SceneContextPointer& sceneContext, cons
assert(renderContext->args); assert(renderContext->args);
assert(renderContext->args->_viewFrustum); assert(renderContext->args->_viewFrustum);
RenderArgs* args = renderContext->args; RenderArgs* args = renderContext->args;
auto& scene = sceneContext->_scene;
gpu::Batch batch; gpu::Batch batch;

View file

@ -12,12 +12,12 @@
#include "DeferredLightingEffect.h" #include "DeferredLightingEffect.h"
#include <GLMHelpers.h> #include <GLMHelpers.h>
#include <gpu/GPUConfig.h> #include <PathUtils.h>
#include <ViewFrustum.h>
#include <gpu/Batch.h> #include <gpu/Batch.h>
#include <gpu/Context.h> #include <gpu/Context.h>
#include <gpu/StandardShaderLib.h> #include <gpu/StandardShaderLib.h>
#include <PathUtils.h>
#include <ViewFrustum.h>
#include "AbstractViewStateInterface.h" #include "AbstractViewStateInterface.h"
#include "GeometryCache.h" #include "GeometryCache.h"
@ -291,7 +291,7 @@ void DeferredLightingEffect::render(RenderArgs* args) {
locations = &_directionalAmbientSphereLightCascadedShadowMapLocations; locations = &_directionalAmbientSphereLightCascadedShadowMapLocations;
} }
batch.setPipeline(program); batch.setPipeline(program);
batch._glUniform3fv(locations->shadowDistances, 1, (const GLfloat*) &_viewState->getShadowDistances()); batch._glUniform3fv(locations->shadowDistances, 1, (const float*) &_viewState->getShadowDistances());
} else { } else {
if (useSkyboxCubemap) { if (useSkyboxCubemap) {
@ -325,7 +325,7 @@ void DeferredLightingEffect::render(RenderArgs* args) {
sh = (*_skybox->getCubemap()->getIrradiance()); sh = (*_skybox->getCubemap()->getIrradiance());
} }
for (int i =0; i <gpu::SphericalHarmonics::NUM_COEFFICIENTS; i++) { for (int i =0; i <gpu::SphericalHarmonics::NUM_COEFFICIENTS; i++) {
batch._glUniform4fv(locations->ambientSphere + i, 1, (const GLfloat*) (&sh) + i * 4); batch._glUniform4fv(locations->ambientSphere + i, 1, (const float*) (&sh) + i * 4);
} }
} }
@ -340,7 +340,7 @@ void DeferredLightingEffect::render(RenderArgs* args) {
if (_atmosphere && (locations->atmosphereBufferUnit >= 0)) { if (_atmosphere && (locations->atmosphereBufferUnit >= 0)) {
batch.setUniformBuffer(locations->atmosphereBufferUnit, _atmosphere->getDataBuffer()); batch.setUniformBuffer(locations->atmosphereBufferUnit, _atmosphere->getDataBuffer());
} }
batch._glUniformMatrix4fv(locations->invViewMat, 1, false, reinterpret_cast< const GLfloat* >(&invViewMat)); batch._glUniformMatrix4fv(locations->invViewMat, 1, false, reinterpret_cast< const float* >(&invViewMat));
} }
float left, right, bottom, top, nearVal, farVal; float left, right, bottom, top, nearVal, farVal;
@ -419,9 +419,9 @@ void DeferredLightingEffect::render(RenderArgs* args) {
batch._glUniform2f(_pointLightLocations.depthTexCoordOffset, depthTexCoordOffsetS, depthTexCoordOffsetT); batch._glUniform2f(_pointLightLocations.depthTexCoordOffset, depthTexCoordOffsetS, depthTexCoordOffsetT);
batch._glUniform2f(_pointLightLocations.depthTexCoordScale, depthTexCoordScaleS, depthTexCoordScaleT); batch._glUniform2f(_pointLightLocations.depthTexCoordScale, depthTexCoordScaleS, depthTexCoordScaleT);
batch._glUniformMatrix4fv(_pointLightLocations.invViewMat, 1, false, reinterpret_cast< const GLfloat* >(&invViewMat)); batch._glUniformMatrix4fv(_pointLightLocations.invViewMat, 1, false, reinterpret_cast< const float* >(&invViewMat));
batch._glUniformMatrix4fv(_pointLightLocations.texcoordMat, 1, false, reinterpret_cast< const GLfloat* >(&texcoordMat)); batch._glUniformMatrix4fv(_pointLightLocations.texcoordMat, 1, false, reinterpret_cast< const float* >(&texcoordMat));
for (auto lightID : _pointLights) { for (auto lightID : _pointLights) {
auto& light = _allocatedLights[lightID]; auto& light = _allocatedLights[lightID];
@ -467,9 +467,9 @@ void DeferredLightingEffect::render(RenderArgs* args) {
batch._glUniform2f(_spotLightLocations.depthTexCoordOffset, depthTexCoordOffsetS, depthTexCoordOffsetT); batch._glUniform2f(_spotLightLocations.depthTexCoordOffset, depthTexCoordOffsetS, depthTexCoordOffsetT);
batch._glUniform2f(_spotLightLocations.depthTexCoordScale, depthTexCoordScaleS, depthTexCoordScaleT); batch._glUniform2f(_spotLightLocations.depthTexCoordScale, depthTexCoordScaleS, depthTexCoordScaleT);
batch._glUniformMatrix4fv(_spotLightLocations.invViewMat, 1, false, reinterpret_cast< const GLfloat* >(&invViewMat)); batch._glUniformMatrix4fv(_spotLightLocations.invViewMat, 1, false, reinterpret_cast< const float* >(&invViewMat));
batch._glUniformMatrix4fv(_spotLightLocations.texcoordMat, 1, false, reinterpret_cast< const GLfloat* >(&texcoordMat)); batch._glUniformMatrix4fv(_spotLightLocations.texcoordMat, 1, false, reinterpret_cast< const float* >(&texcoordMat));
for (auto lightID : _spotLights) { for (auto lightID : _spotLights) {
auto light = _allocatedLights[lightID]; auto light = _allocatedLights[lightID];
@ -489,7 +489,7 @@ void DeferredLightingEffect::render(RenderArgs* args) {
if ((eyeHalfPlaneDistance > -nearRadius) && if ((eyeHalfPlaneDistance > -nearRadius) &&
(glm::distance(eyePoint, glm::vec3(light->getPosition())) < expandedRadius + nearRadius)) { (glm::distance(eyePoint, glm::vec3(light->getPosition())) < expandedRadius + nearRadius)) {
coneParam.w = 0.0f; coneParam.w = 0.0f;
batch._glUniform4fv(_spotLightLocations.coneParam, 1, reinterpret_cast< const GLfloat* >(&coneParam)); batch._glUniform4fv(_spotLightLocations.coneParam, 1, reinterpret_cast< const float* >(&coneParam));
Transform model; Transform model;
model.setTranslation(glm::vec3(0.0f, 0.0f, -1.0f)); model.setTranslation(glm::vec3(0.0f, 0.0f, -1.0f));
@ -509,7 +509,7 @@ void DeferredLightingEffect::render(RenderArgs* args) {
batch.setViewTransform(viewMat); batch.setViewTransform(viewMat);
} else { } else {
coneParam.w = 1.0f; coneParam.w = 1.0f;
batch._glUniform4fv(_spotLightLocations.coneParam, 1, reinterpret_cast< const GLfloat* >(&coneParam)); batch._glUniform4fv(_spotLightLocations.coneParam, 1, reinterpret_cast< const float* >(&coneParam));
Transform model; Transform model;
model.setTranslation(light->getPosition()); model.setTranslation(light->getPosition());
@ -595,9 +595,9 @@ void DeferredLightingEffect::loadLightProgram(const char* vertSource, const char
slotBindings.insert(gpu::Shader::Binding(std::string("depthMap"), 3)); slotBindings.insert(gpu::Shader::Binding(std::string("depthMap"), 3));
slotBindings.insert(gpu::Shader::Binding(std::string("shadowMap"), 4)); slotBindings.insert(gpu::Shader::Binding(std::string("shadowMap"), 4));
slotBindings.insert(gpu::Shader::Binding(std::string("skyboxMap"), 5)); slotBindings.insert(gpu::Shader::Binding(std::string("skyboxMap"), 5));
const GLint LIGHT_GPU_SLOT = 3; const int LIGHT_GPU_SLOT = 3;
slotBindings.insert(gpu::Shader::Binding(std::string("lightBuffer"), LIGHT_GPU_SLOT)); slotBindings.insert(gpu::Shader::Binding(std::string("lightBuffer"), LIGHT_GPU_SLOT));
const GLint ATMOSPHERE_GPU_SLOT = 4; const int ATMOSPHERE_GPU_SLOT = 4;
slotBindings.insert(gpu::Shader::Binding(std::string("atmosphereBufferUnit"), ATMOSPHERE_GPU_SLOT)); slotBindings.insert(gpu::Shader::Binding(std::string("atmosphereBufferUnit"), ATMOSPHERE_GPU_SLOT));
gpu::Shader::makeProgram(*program, slotBindings); gpu::Shader::makeProgram(*program, slotBindings);
@ -614,13 +614,8 @@ void DeferredLightingEffect::loadLightProgram(const char* vertSource, const char
locations.texcoordMat = program->getUniforms().findLocation("texcoordMat"); locations.texcoordMat = program->getUniforms().findLocation("texcoordMat");
locations.coneParam = program->getUniforms().findLocation("coneParam"); locations.coneParam = program->getUniforms().findLocation("coneParam");
#if (GPU_FEATURE_PROFILE == GPU_CORE)
locations.lightBufferUnit = program->getBuffers().findLocation("lightBuffer"); locations.lightBufferUnit = program->getBuffers().findLocation("lightBuffer");
locations.atmosphereBufferUnit = program->getBuffers().findLocation("atmosphereBufferUnit"); locations.atmosphereBufferUnit = program->getBuffers().findLocation("atmosphereBufferUnit");
#else
locations.lightBufferUnit = program->getUniforms().findLocation("lightBuffer");
locations.atmosphereBufferUnit = program->getUniforms().findLocation("atmosphereBufferUnit");
#endif
auto state = std::make_shared<gpu::State>(); auto state = std::make_shared<gpu::State>();
if (lightVolume) { if (lightVolume) {
@ -677,10 +672,10 @@ model::MeshPointer DeferredLightingEffect::getSpotLightMesh() {
int ringFloatOffset = slices * 3; int ringFloatOffset = slices * 3;
GLfloat* vertexData = new GLfloat[verticesSize]; float* vertexData = new float[verticesSize];
GLfloat* vertexRing0 = vertexData; float* vertexRing0 = vertexData;
GLfloat* vertexRing1 = vertexRing0 + ringFloatOffset; float* vertexRing1 = vertexRing0 + ringFloatOffset;
GLfloat* vertexRing2 = vertexRing1 + ringFloatOffset; float* vertexRing2 = vertexRing1 + ringFloatOffset;
for (int i = 0; i < slices; i++) { for (int i = 0; i < slices; i++) {
float theta = TWO_PI * i / slices; float theta = TWO_PI * i / slices;
@ -746,7 +741,7 @@ model::MeshPointer DeferredLightingEffect::getSpotLightMesh() {
*(index++) = capVertex; *(index++) = capVertex;
} }
_spotLightMesh->setIndexBuffer(gpu::BufferView(new gpu::Buffer(sizeof(GLushort) * indices, (gpu::Byte*) indexData), gpu::Element::INDEX_UINT16)); _spotLightMesh->setIndexBuffer(gpu::BufferView(new gpu::Buffer(sizeof(unsigned short) * indices, (gpu::Byte*) indexData), gpu::Element::INDEX_UINT16));
delete[] indexData; delete[] indexData;
model::Mesh::Part part(0, indices, 0, model::Mesh::TRIANGLES); model::Mesh::Part part(0, indices, 0, model::Mesh::TRIANGLES);

View file

@ -18,7 +18,6 @@
#include <QMap> #include <QMap>
#include <QQueue> #include <QQueue>
#include <gpu/Batch.h> #include <gpu/Batch.h>
#include <gpu/GPUConfig.h>
#include "RenderUtilsLogging.h" #include "RenderUtilsLogging.h"
static QQueue<gpu::FramebufferPointer> _cachedFramebuffers; static QQueue<gpu::FramebufferPointer> _cachedFramebuffers;

View file

@ -9,22 +9,22 @@
// 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
// //
// include this before QOpenGLBuffer, which includes an earlier version of OpenGL #include "GeometryCache.h"
#include <cmath> #include <cmath>
#include <QNetworkReply> #include <QNetworkReply>
#include <QRunnable> #include <QRunnable>
#include <QThreadPool> #include <QThreadPool>
#include <gpu/Batch.h>
#include <gpu/GLBackend.h>
#include <FSTReader.h> #include <FSTReader.h>
#include <NumericalConstants.h> #include <NumericalConstants.h>
#include <gpu/Batch.h>
#include <gpu/GLBackend.h>
#include "TextureCache.h" #include "TextureCache.h"
#include "RenderUtilsLogging.h" #include "RenderUtilsLogging.h"
#include "GeometryCache.h"
#include "standardTransformPNTC_vert.h" #include "standardTransformPNTC_vert.h"
#include "standardDrawTexture_frag.h" #include "standardDrawTexture_frag.h"

View file

@ -18,20 +18,18 @@
#include <CapsuleShape.h> #include <CapsuleShape.h>
#include <GeometryUtil.h> #include <GeometryUtil.h>
#include <gpu/Batch.h>
#include <gpu/GLBackend.h>
#include <PathUtils.h> #include <PathUtils.h>
#include <PerfStat.h> #include <PerfStat.h>
#include "PhysicsEntity.h"
#include <ShapeCollider.h> #include <ShapeCollider.h>
#include <SphereShape.h> #include <SphereShape.h>
#include <ViewFrustum.h> #include <ViewFrustum.h>
#include <render/Scene.h>
#include <gpu/Batch.h>
#include "AbstractViewStateInterface.h" #include "AbstractViewStateInterface.h"
#include "AnimationHandle.h" #include "AnimationHandle.h"
#include "DeferredLightingEffect.h" #include "DeferredLightingEffect.h"
#include "Model.h" #include "Model.h"
#include "RenderUtilsLogging.h"
#include "model_vert.h" #include "model_vert.h"
#include "model_shadow_vert.h" #include "model_shadow_vert.h"
@ -96,7 +94,7 @@ Model::~Model() {
} }
Model::RenderPipelineLib Model::_renderPipelineLib; Model::RenderPipelineLib Model::_renderPipelineLib;
const GLint MATERIAL_GPU_SLOT = 3; const int MATERIAL_GPU_SLOT = 3;
void Model::RenderPipelineLib::addRenderPipeline(Model::RenderKey key, void Model::RenderPipelineLib::addRenderPipeline(Model::RenderKey key,
gpu::ShaderPointer& vertexShader, gpu::ShaderPointer& vertexShader,
@ -189,13 +187,9 @@ void Model::RenderPipelineLib::initLocations(gpu::ShaderPointer& program, Model:
locations.specularTextureUnit = program->getTextures().findLocation("specularMap"); locations.specularTextureUnit = program->getTextures().findLocation("specularMap");
locations.emissiveTextureUnit = program->getTextures().findLocation("emissiveMap"); locations.emissiveTextureUnit = program->getTextures().findLocation("emissiveMap");
#if (GPU_FEATURE_PROFILE == GPU_CORE)
locations.materialBufferUnit = program->getBuffers().findLocation("materialBuffer"); locations.materialBufferUnit = program->getBuffers().findLocation("materialBuffer");
locations.lightBufferUnit = program->getBuffers().findLocation("lightBuffer"); locations.lightBufferUnit = program->getBuffers().findLocation("lightBuffer");
#else
locations.materialBufferUnit = program->getUniforms().findLocation("materialBuffer");
locations.lightBufferUnit = program->getUniforms().findLocation("lightBuffer");
#endif
locations.clusterMatrices = program->getUniforms().findLocation("clusterMatrices"); locations.clusterMatrices = program->getUniforms().findLocation("clusterMatrices");
locations.clusterIndices = program->getInputs().findLocation("clusterIndices");; locations.clusterIndices = program->getInputs().findLocation("clusterIndices");;

View file

@ -11,12 +11,10 @@
// //
#include "RenderDeferredTask.h" #include "RenderDeferredTask.h"
#include <gpu/GPUConfig.h>
#include <gpu/Batch.h>
#include <gpu/Context.h>
#include <PerfStat.h> #include <PerfStat.h>
#include <RenderArgs.h> #include <RenderArgs.h>
#include <ViewFrustum.h> #include <ViewFrustum.h>
#include <gpu/Context.h>
#include "FramebufferCache.h" #include "FramebufferCache.h"
#include "DeferredLightingEffect.h" #include "DeferredLightingEffect.h"

View file

@ -16,16 +16,15 @@
#include <glm/glm.hpp> #include <glm/glm.hpp>
#include <glm/gtc/random.hpp> #include <glm/gtc/random.hpp>
#include <gpu/Batch.h>
#include <gpu/GLBackend.h>
#include <gpu/GPUConfig.h>
#include <QNetworkReply> #include <QNetworkReply>
#include <QPainter> #include <QPainter>
#include <QRunnable> #include <QRunnable>
#include <QThreadPool> #include <QThreadPool>
#include <qimagereader.h> #include <qimagereader.h>
#include <gpu/Batch.h>
#include "RenderUtilsLogging.h" #include "RenderUtilsLogging.h"

View file

@ -15,15 +15,11 @@
#include <assert.h> #include <assert.h>
#include <PerfStat.h> #include <PerfStat.h>
#include <gpu/Batch.h>
#include <gpu/Context.h>
#include <gpu/GPUConfig.h>
#include <gpu/GPULogging.h>
#include <ViewFrustum.h> #include <ViewFrustum.h>
#include <RenderArgs.h> #include <RenderArgs.h>
#include <gpu/Context.h>
#include "drawItemBounds_vert.h" #include "drawItemBounds_vert.h"
#include "drawItemBounds_frag.h" #include "drawItemBounds_frag.h"
#include "drawItemStatus_vert.h" #include "drawItemStatus_vert.h"
@ -152,17 +148,17 @@ void DrawStatus::run(const SceneContextPointer& sceneContext, const RenderContex
const unsigned int VEC3_ADRESS_OFFSET = 3; const unsigned int VEC3_ADRESS_OFFSET = 3;
for (int i = 0; i < nbItems; i++) { for (int i = 0; i < nbItems; i++) {
batch._glUniform3fv(_drawItemBoundPosLoc, 1, (const GLfloat*) (itemAABox + i)); batch._glUniform3fv(_drawItemBoundPosLoc, 1, (const float*) (itemAABox + i));
batch._glUniform3fv(_drawItemBoundDimLoc, 1, ((const GLfloat*) (itemAABox + i)) + VEC3_ADRESS_OFFSET); batch._glUniform3fv(_drawItemBoundDimLoc, 1, ((const float*) (itemAABox + i)) + VEC3_ADRESS_OFFSET);
batch.draw(gpu::LINES, 24, 0); batch.draw(gpu::LINES, 24, 0);
} }
batch.setPipeline(getDrawItemStatusPipeline()); batch.setPipeline(getDrawItemStatusPipeline());
for (int i = 0; i < nbItems; i++) { for (int i = 0; i < nbItems; i++) {
batch._glUniform3fv(_drawItemStatusPosLoc, 1, (const GLfloat*) (itemAABox + i)); batch._glUniform3fv(_drawItemStatusPosLoc, 1, (const float*) (itemAABox + i));
batch._glUniform3fv(_drawItemStatusDimLoc, 1, ((const GLfloat*) (itemAABox + i)) + VEC3_ADRESS_OFFSET); batch._glUniform3fv(_drawItemStatusDimLoc, 1, ((const float*) (itemAABox + i)) + VEC3_ADRESS_OFFSET);
batch._glUniform4iv(_drawItemStatusValueLoc, 1, (const GLint*) (itemStatus + i)); batch._glUniform4iv(_drawItemStatusValueLoc, 1, (const int*) (itemStatus + i));
batch.draw(gpu::TRIANGLES, 24, 0); batch.draw(gpu::TRIANGLES, 24, 0);
} }
@ -171,4 +167,4 @@ void DrawStatus::run(const SceneContextPointer& sceneContext, const RenderContex
args->_context->syncCache(); args->_context->syncCache();
renderContext->args->_context->syncCache(); renderContext->args->_context->syncCache();
args->_context->render((batch)); args->_context->render((batch));
} }

View file

@ -14,12 +14,10 @@
#include <algorithm> #include <algorithm>
#include <assert.h> #include <assert.h>
#include <gpu/Batch.h>
#include <gpu/Context.h>
#include <gpu/GPUConfig.h>
#include <PerfStat.h> #include <PerfStat.h>
#include <RenderArgs.h> #include <RenderArgs.h>
#include <ViewFrustum.h> #include <ViewFrustum.h>
#include <gpu/Context.h>
using namespace render; using namespace render;

View file

@ -8,30 +8,35 @@
// 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
// //
#include <gpu/GPUConfig.h>
#include <QWindow>
#include <QFile>
#include <QTime>
#include <QImage>
#include <QTimer>
#include <QElapsedTimer>
#include <QOpenGLContext>
#include <QOpenGLBuffer>
#include <QOpenGLShaderProgram>
#include <QResizeEvent>
#include <QLoggingCategory>
#include <QOpenGLTexture>
#include <QOpenGLVertexArrayObject>
#include <QApplication>
#include <QOpenGLDebugLogger>
#include <unordered_map> #include <unordered_map>
#include <memory> #include <memory>
#include <glm/glm.hpp> #include <glm/glm.hpp>
#include <PathUtils.h> #include <QApplication>
#include <QDir> #include <QDir>
#include <QElapsedTimer>
#include <QFile>
#include <QImage>
#include <QLoggingCategory>
#include <gpu/Context.h>
#include <gpu/GLBackend.h>
#include <QOpenGLBuffer>
#include <QOpenGLContext>
#include <QOpenGLDebugLogger>
#include <QOpenGLShaderProgram>
#include <QOpenGLTexture>
#include <QOpenGLVertexArrayObject>
#include <QResizeEvent>
#include <QTime>
#include <QTimer>
#include <QWindow>
#include <PathUtils.h>
class RateCounter { class RateCounter {
std::vector<float> times; std::vector<float> times;
@ -119,6 +124,10 @@ public:
show(); show();
makeCurrent(); makeCurrent();
gpu::Context::init<gpu::GLBackend>();
{ {
QOpenGLDebugLogger* logger = new QOpenGLDebugLogger(this); QOpenGLDebugLogger* logger = new QOpenGLDebugLogger(this);
logger->initialize(); // initializes in the current context, i.e. ctx logger->initialize(); // initializes in the current context, i.e. ctx
@ -130,23 +139,6 @@ public:
} }
qDebug() << (const char*)glGetString(GL_VERSION); qDebug() << (const char*)glGetString(GL_VERSION);
#ifdef WIN32
glewExperimental = true;
GLenum err = glewInit();
if (GLEW_OK != err) {
/* Problem: glewInit failed, something is seriously wrong. */
const GLubyte * errStr = glewGetErrorString(err);
qDebug("Error: %s\n", errStr);
}
qDebug("Status: Using GLEW %s\n", glewGetString(GLEW_VERSION));
if (wglewGetExtension("WGL_EXT_swap_control")) {
int swapInterval = wglGetSwapIntervalEXT();
qDebug("V-Sync is %s\n", (swapInterval > 0 ? "ON" : "OFF"));
}
glGetError();
#endif
//_textRenderer[0] = TextRenderer::getInstance(SANS_FONT_FAMILY, 12, false); //_textRenderer[0] = TextRenderer::getInstance(SANS_FONT_FAMILY, 12, false);
//_textRenderer[1] = TextRenderer::getInstance(SERIF_FONT_FAMILY, 12, false, //_textRenderer[1] = TextRenderer::getInstance(SERIF_FONT_FAMILY, 12, false,
// TextRenderer::SHADOW_EFFECT); // TextRenderer::SHADOW_EFFECT);