mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 23:16:50 +02:00
Preparing for first pr
This commit is contained in:
parent
7b35048e52
commit
7ac2030862
10 changed files with 57 additions and 72 deletions
|
@ -765,32 +765,9 @@ void Application::initializeGL() {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
qCDebug(interfaceapp) << "GL Version: " << QString((const char*) glGetString(GL_VERSION));
|
|
||||||
qCDebug(interfaceapp) << "GL Shader Language Version: " << QString((const char*) glGetString(GL_SHADING_LANGUAGE_VERSION));
|
|
||||||
qCDebug(interfaceapp) << "GL Vendor: " << QString((const char*) glGetString(GL_VENDOR));
|
|
||||||
qCDebug(interfaceapp) << "GL Renderer: " << QString((const char*) glGetString(GL_RENDERER));
|
|
||||||
|
|
||||||
#ifdef WIN32
|
// Where the gpuContext is created and where the TRUE Backend is created and assigned
|
||||||
GLenum err = glewInit();
|
_gpuContext = std::make_shared<gpu::Context>(new gpu::GLBackend());
|
||||||
if (GLEW_OK != err) {
|
|
||||||
/* Problem: glewInit failed, something is seriously wrong. */
|
|
||||||
qCDebug(interfaceapp, "Error: %s\n", glewGetErrorString(err));
|
|
||||||
}
|
|
||||||
qCDebug(interfaceapp, "Status: Using GLEW %s\n", glewGetString(GLEW_VERSION));
|
|
||||||
|
|
||||||
if (wglewGetExtension("WGL_EXT_swap_control")) {
|
|
||||||
int swapInterval = wglGetSwapIntervalEXT();
|
|
||||||
qCDebug(interfaceapp, "V-Sync is %s\n", (swapInterval > 0 ? "ON" : "OFF"));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(Q_OS_LINUX)
|
|
||||||
// TODO: Write the correct code for Linux...
|
|
||||||
/* if (wglewGetExtension("WGL_EXT_swap_control")) {
|
|
||||||
int swapInterval = wglGetSwapIntervalEXT();
|
|
||||||
qCDebug(interfaceapp, "V-Sync is %s\n", (swapInterval > 0 ? "ON" : "OFF"));
|
|
||||||
}*/
|
|
||||||
#endif
|
|
||||||
|
|
||||||
initDisplay();
|
initDisplay();
|
||||||
qCDebug(interfaceapp, "Initialized Display.");
|
qCDebug(interfaceapp, "Initialized Display.");
|
||||||
|
@ -879,8 +856,9 @@ void Application::paintGL() {
|
||||||
_glWidget->makeCurrent();
|
_glWidget->makeCurrent();
|
||||||
|
|
||||||
auto lodManager = DependencyManager::get<LODManager>();
|
auto lodManager = DependencyManager::get<LODManager>();
|
||||||
gpu::Context context(new gpu::GLBackend());
|
|
||||||
RenderArgs renderArgs(&context, nullptr, getViewFrustum(), lodManager->getOctreeSizeScale(),
|
|
||||||
|
RenderArgs renderArgs(_gpuContext, nullptr, getViewFrustum(), lodManager->getOctreeSizeScale(),
|
||||||
lodManager->getBoundaryLevelAdjust(), RenderArgs::DEFAULT_RENDER_MODE,
|
lodManager->getBoundaryLevelAdjust(), RenderArgs::DEFAULT_RENDER_MODE,
|
||||||
RenderArgs::MONO, RenderArgs::RENDER_DEBUG_NONE);
|
RenderArgs::MONO, RenderArgs::RENDER_DEBUG_NONE);
|
||||||
|
|
||||||
|
@ -896,6 +874,7 @@ void Application::paintGL() {
|
||||||
PerformanceWarning warn(showWarnings, "Application::paintGL()");
|
PerformanceWarning warn(showWarnings, "Application::paintGL()");
|
||||||
resizeGL();
|
resizeGL();
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
PerformanceTimer perfTimer("renderOverlay");
|
PerformanceTimer perfTimer("renderOverlay");
|
||||||
|
|
||||||
|
@ -906,8 +885,6 @@ void Application::paintGL() {
|
||||||
_applicationOverlay.renderOverlay(&renderArgs);
|
_applicationOverlay.renderOverlay(&renderArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
glEnable(GL_LINE_SMOOTH);
|
|
||||||
|
|
||||||
if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON || _myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) {
|
if (_myCamera.getMode() == CAMERA_MODE_FIRST_PERSON || _myCamera.getMode() == CAMERA_MODE_THIRD_PERSON) {
|
||||||
Menu::getInstance()->setIsOptionChecked(MenuOption::FirstPerson, _myAvatar->getBoomLength() <= MyAvatar::ZOOM_MIN);
|
Menu::getInstance()->setIsOptionChecked(MenuOption::FirstPerson, _myAvatar->getBoomLength() <= MyAvatar::ZOOM_MIN);
|
||||||
Menu::getInstance()->setIsOptionChecked(MenuOption::ThirdPerson, !(_myAvatar->getBoomLength() <= MyAvatar::ZOOM_MIN));
|
Menu::getInstance()->setIsOptionChecked(MenuOption::ThirdPerson, !(_myAvatar->getBoomLength() <= MyAvatar::ZOOM_MIN));
|
||||||
|
@ -958,7 +935,6 @@ void Application::paintGL() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sync up the View Furstum with the camera
|
// Sync up the View Furstum with the camera
|
||||||
// FIXME: it's happening again in the updateSHadow and it shouldn't, this should be the place
|
|
||||||
loadViewFrustum(_myCamera, _viewFrustum);
|
loadViewFrustum(_myCamera, _viewFrustum);
|
||||||
|
|
||||||
|
|
||||||
|
@ -997,7 +973,7 @@ void Application::paintGL() {
|
||||||
|
|
||||||
displaySide(&renderArgs, _myCamera);
|
displaySide(&renderArgs, _myCamera);
|
||||||
|
|
||||||
if (_myCamera.getMode() != CAMERA_MODE_MIRROR && Menu::getInstance()->isOptionChecked(MenuOption::Mirror)) {
|
if (Menu::getInstance()->isOptionChecked(MenuOption::Mirror)) {
|
||||||
renderArgs._renderMode = RenderArgs::MIRROR_RENDER_MODE;
|
renderArgs._renderMode = RenderArgs::MIRROR_RENDER_MODE;
|
||||||
renderRearViewMirror(&renderArgs, _mirrorViewRect);
|
renderRearViewMirror(&renderArgs, _mirrorViewRect);
|
||||||
renderArgs._renderMode = RenderArgs::NORMAL_RENDER_MODE;
|
renderArgs._renderMode = RenderArgs::NORMAL_RENDER_MODE;
|
||||||
|
@ -3172,10 +3148,6 @@ namespace render {
|
||||||
model::Skybox::render(batch, *(Application::getInstance()->getDisplayViewFrustum()), *skybox);
|
model::Skybox::render(batch, *(Application::getInstance()->getDisplayViewFrustum()), *skybox);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// FIX ME - If I don't call this renderBatch() here, then the atmosphere and skybox don't render, but it
|
|
||||||
// seems like these payloadRender() methods shouldn't be doing this. We need to investigate why the engine
|
|
||||||
// isn't rendering our batch
|
|
||||||
gpu::GLBackend::renderBatch(batch, true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3444,7 +3416,6 @@ void Application::renderRearViewMirror(RenderArgs* renderArgs, const QRect& regi
|
||||||
bool updateViewFrustum = false;
|
bool updateViewFrustum = false;
|
||||||
loadViewFrustum(_mirrorCamera, _viewFrustum);
|
loadViewFrustum(_mirrorCamera, _viewFrustum);
|
||||||
|
|
||||||
|
|
||||||
// render rear mirror view
|
// render rear mirror view
|
||||||
displaySide(renderArgs, _mirrorCamera, true, billboard);
|
displaySide(renderArgs, _mirrorCamera, true, billboard);
|
||||||
|
|
||||||
|
|
|
@ -69,6 +69,7 @@
|
||||||
#include "octree/OctreePacketProcessor.h"
|
#include "octree/OctreePacketProcessor.h"
|
||||||
#include "UndoStackScriptingInterface.h"
|
#include "UndoStackScriptingInterface.h"
|
||||||
|
|
||||||
|
#include "gpu/Context.h"
|
||||||
#include "render/Engine.h"
|
#include "render/Engine.h"
|
||||||
|
|
||||||
class QGLWidget;
|
class QGLWidget;
|
||||||
|
@ -326,6 +327,8 @@ public:
|
||||||
|
|
||||||
render::ScenePointer getMain3DScene() const { return _main3DScene; }
|
render::ScenePointer getMain3DScene() const { return _main3DScene; }
|
||||||
|
|
||||||
|
gpu::ContextPointer getGPUContext() const { return _gpuContext; }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
/// Fired when we're simulating; allows external parties to hook in.
|
/// Fired when we're simulating; allows external parties to hook in.
|
||||||
|
@ -633,6 +636,7 @@ private:
|
||||||
|
|
||||||
render::ScenePointer _main3DScene{ new render::Scene() };
|
render::ScenePointer _main3DScene{ new render::Scene() };
|
||||||
render::EnginePointer _renderEngine{ new render::Engine() };
|
render::EnginePointer _renderEngine{ new render::Engine() };
|
||||||
|
gpu::ContextPointer _gpuContext; // initialized during window creation
|
||||||
|
|
||||||
Overlays _overlays;
|
Overlays _overlays;
|
||||||
ApplicationOverlay _applicationOverlay;
|
ApplicationOverlay _applicationOverlay;
|
||||||
|
|
|
@ -1524,8 +1524,8 @@ void MyAvatar::maybeUpdateBillboard() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gpu::Context context(new gpu::GLBackend());
|
|
||||||
RenderArgs renderArgs(&context);
|
RenderArgs renderArgs(qApp->getGPUContext());
|
||||||
QImage image = qApp->renderAvatarBillboard(&renderArgs);
|
QImage image = qApp->renderAvatarBillboard(&renderArgs);
|
||||||
_billboard.clear();
|
_billboard.clear();
|
||||||
QBuffer buffer(&_billboard);
|
QBuffer buffer(&_billboard);
|
||||||
|
|
|
@ -49,7 +49,6 @@ private:
|
||||||
gpu::TexturePointer _overlayDepthTexture;
|
gpu::TexturePointer _overlayDepthTexture;
|
||||||
gpu::TexturePointer _overlayColorTexture;
|
gpu::TexturePointer _overlayColorTexture;
|
||||||
gpu::FramebufferPointer _overlayFramebuffer;
|
gpu::FramebufferPointer _overlayFramebuffer;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_ApplicationOverlay_h
|
#endif // hifi_ApplicationOverlay_h
|
||||||
|
|
|
@ -134,7 +134,7 @@ protected:
|
||||||
|
|
||||||
friend class Shader;
|
friend class Shader;
|
||||||
};
|
};
|
||||||
|
typedef std::shared_ptr<Context> ContextPointer;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
|
|
||||||
using namespace gpu;
|
using namespace gpu;
|
||||||
|
|
||||||
|
bool GLBackend::_initialized = false;
|
||||||
|
|
||||||
GLBackend::CommandCall GLBackend::_commandCalls[Batch::NUM_COMMANDS] =
|
GLBackend::CommandCall GLBackend::_commandCalls[Batch::NUM_COMMANDS] =
|
||||||
{
|
{
|
||||||
(&::gpu::GLBackend::do_draw),
|
(&::gpu::GLBackend::do_draw),
|
||||||
|
@ -89,13 +91,38 @@ GLBackend::GLBackend() :
|
||||||
_pipeline(),
|
_pipeline(),
|
||||||
_output()
|
_output()
|
||||||
{
|
{
|
||||||
|
if (!_initialized) {
|
||||||
|
qCDebug(gpulogging) << "GL Version: " << QString((const char*) glGetString(GL_VERSION));
|
||||||
|
qCDebug(gpulogging) << "GL Shader Language Version: " << QString((const char*) glGetString(GL_SHADING_LANGUAGE_VERSION));
|
||||||
|
qCDebug(gpulogging) << "GL Vendor: " << QString((const char*) glGetString(GL_VENDOR));
|
||||||
|
qCDebug(gpulogging) << "GL Renderer: " << QString((const char*) glGetString(GL_RENDERER));
|
||||||
|
|
||||||
|
#ifdef WIN32
|
||||||
|
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));
|
||||||
|
|
||||||
|
if (wglewGetExtension("WGL_EXT_swap_control")) {
|
||||||
|
int swapInterval = wglGetSwapIntervalEXT();
|
||||||
|
qCDebug(gpulogging, "V-Sync is %s\n", (swapInterval > 0 ? "ON" : "OFF"));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(Q_OS_LINUX)
|
||||||
|
// TODO: Write the correct code for Linux...
|
||||||
|
/* if (wglewGetExtension("WGL_EXT_swap_control")) {
|
||||||
|
int swapInterval = wglGetSwapIntervalEXT();
|
||||||
|
qCDebug(gpulogging, "V-Sync is %s\n", (swapInterval > 0 ? "ON" : "OFF"));
|
||||||
|
}*/
|
||||||
|
#endif
|
||||||
|
_initialized = true;
|
||||||
|
}
|
||||||
|
|
||||||
initInput();
|
initInput();
|
||||||
initTransform();
|
initTransform();
|
||||||
|
|
||||||
qCDebug(gpulogging) << "GL Version: " << QString((const char*) glGetString(GL_VERSION));
|
|
||||||
qCDebug(gpulogging) << "GL Shader Language Version: " << QString((const char*) glGetString(GL_SHADING_LANGUAGE_VERSION));
|
|
||||||
qCDebug(gpulogging) << "GL Vendor: " << QString((const char*) glGetString(GL_VENDOR));
|
|
||||||
qCDebug(gpulogging) << "GL Renderer: " << QString((const char*) glGetString(GL_RENDERER));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GLBackend::~GLBackend() {
|
GLBackend::~GLBackend() {
|
||||||
|
@ -118,6 +145,7 @@ void GLBackend::render(Batch& batch) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLBackend::renderBatch(Batch& batch, bool syncCache) {
|
void GLBackend::renderBatch(Batch& batch, bool syncCache) {
|
||||||
|
qCDebug(gpulogging) << "GLBackend::renderBatch : Deprecated call, don;t do it!!!";
|
||||||
GLBackend backend;
|
GLBackend backend;
|
||||||
if (syncCache) {
|
if (syncCache) {
|
||||||
backend.syncCache();
|
backend.syncCache();
|
||||||
|
@ -171,6 +199,8 @@ void GLBackend::syncCache() {
|
||||||
syncTransformStateCache();
|
syncTransformStateCache();
|
||||||
syncPipelineStateCache();
|
syncPipelineStateCache();
|
||||||
syncInputStateCache();
|
syncInputStateCache();
|
||||||
|
|
||||||
|
glEnable(GL_LINE_SMOOTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLBackend::do_draw(Batch& batch, uint32 paramOffset) {
|
void GLBackend::do_draw(Batch& batch, uint32 paramOffset) {
|
||||||
|
|
|
@ -448,6 +448,7 @@ protected:
|
||||||
typedef void (GLBackend::*CommandCall)(Batch&, uint32);
|
typedef void (GLBackend::*CommandCall)(Batch&, uint32);
|
||||||
static CommandCall _commandCalls[Batch::NUM_COMMANDS];
|
static CommandCall _commandCalls[Batch::NUM_COMMANDS];
|
||||||
|
|
||||||
|
static bool _initialized;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -237,27 +237,6 @@ GLuint TextureCache::getPrimaryDepthTextureID() {
|
||||||
return gpu::GLBackend::getTextureID(getPrimaryDepthTexture());
|
return gpu::GLBackend::getTextureID(getPrimaryDepthTexture());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextureCache::setPrimaryDrawBuffers(bool color, bool normal, bool specular) {
|
|
||||||
gpu::Batch batch;
|
|
||||||
setPrimaryDrawBuffers(batch, color, normal, specular);
|
|
||||||
gpu::GLBackend::renderBatch(batch);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TextureCache::setPrimaryDrawBuffers(gpu::Batch& batch, bool color, bool normal, bool specular) {
|
|
||||||
GLenum buffers[3];
|
|
||||||
int bufferCount = 0;
|
|
||||||
if (color) {
|
|
||||||
buffers[bufferCount++] = GL_COLOR_ATTACHMENT0;
|
|
||||||
}
|
|
||||||
if (normal) {
|
|
||||||
buffers[bufferCount++] = GL_COLOR_ATTACHMENT1;
|
|
||||||
}
|
|
||||||
if (specular) {
|
|
||||||
buffers[bufferCount++] = GL_COLOR_ATTACHMENT2;
|
|
||||||
}
|
|
||||||
batch._glDrawBuffers(bufferCount, buffers);
|
|
||||||
}
|
|
||||||
|
|
||||||
gpu::FramebufferPointer TextureCache::getSecondaryFramebuffer() {
|
gpu::FramebufferPointer TextureCache::getSecondaryFramebuffer() {
|
||||||
if (!_secondaryFramebuffer) {
|
if (!_secondaryFramebuffer) {
|
||||||
_secondaryFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create(gpu::Element::COLOR_RGBA_32, _frameBufferSize.width(), _frameBufferSize.height()));
|
_secondaryFramebuffer = gpu::FramebufferPointer(gpu::Framebuffer::create(gpu::Element::COLOR_RGBA_32, _frameBufferSize.width(), _frameBufferSize.height()));
|
||||||
|
|
|
@ -79,10 +79,6 @@ public:
|
||||||
/// Returns the ID of the primary framebuffer object's depth texture. This contains the Z buffer used in rendering.
|
/// Returns the ID of the primary framebuffer object's depth texture. This contains the Z buffer used in rendering.
|
||||||
uint32_t getPrimaryDepthTextureID();
|
uint32_t getPrimaryDepthTextureID();
|
||||||
|
|
||||||
/// Enables or disables draw buffers on the primary framebuffer. Note: the primary framebuffer must be bound.
|
|
||||||
void setPrimaryDrawBuffers(bool color, bool normal = false, bool specular = false);
|
|
||||||
void setPrimaryDrawBuffers(gpu::Batch& batch, bool color, bool normal = false, bool specular = false);
|
|
||||||
|
|
||||||
/// Returns a pointer to the secondary framebuffer object, used as an additional render target when performing full
|
/// Returns a pointer to the secondary framebuffer object, used as an additional render target when performing full
|
||||||
/// screen effects.
|
/// screen effects.
|
||||||
gpu::FramebufferPointer getSecondaryFramebuffer();
|
gpu::FramebufferPointer getSecondaryFramebuffer();
|
||||||
|
@ -94,6 +90,11 @@ public:
|
||||||
/// Returns the framebuffer object used to render shadow maps;
|
/// Returns the framebuffer object used to render shadow maps;
|
||||||
gpu::FramebufferPointer getShadowFramebuffer();
|
gpu::FramebufferPointer getShadowFramebuffer();
|
||||||
|
|
||||||
|
|
||||||
|
// The framebuffer used for the selfie view of the avatar. used for creating the billboard view and the rearViewMirror image
|
||||||
|
gpu::FramebufferPointer getSelfieFramebuffer();
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
virtual QSharedPointer<Resource> createResource(const QUrl& url,
|
virtual QSharedPointer<Resource> createResource(const QUrl& url,
|
||||||
|
|
|
@ -80,7 +80,7 @@ public:
|
||||||
RENDER_DEBUG_SIMULATION_OWNERSHIP = 2,
|
RENDER_DEBUG_SIMULATION_OWNERSHIP = 2,
|
||||||
};
|
};
|
||||||
|
|
||||||
RenderArgs(gpu::Context* context = nullptr,
|
RenderArgs(std::shared_ptr<gpu::Context> context = nullptr,
|
||||||
OctreeRenderer* renderer = nullptr,
|
OctreeRenderer* renderer = nullptr,
|
||||||
ViewFrustum* viewFrustum = nullptr,
|
ViewFrustum* viewFrustum = nullptr,
|
||||||
float sizeScale = 1.0f,
|
float sizeScale = 1.0f,
|
||||||
|
@ -102,7 +102,7 @@ public:
|
||||||
_shouldRender(shouldRender) {
|
_shouldRender(shouldRender) {
|
||||||
}
|
}
|
||||||
|
|
||||||
gpu::Context* _context = nullptr;
|
std::shared_ptr<gpu::Context> _context = nullptr;
|
||||||
OctreeRenderer* _renderer = nullptr;
|
OctreeRenderer* _renderer = nullptr;
|
||||||
ViewFrustum* _viewFrustum = nullptr;
|
ViewFrustum* _viewFrustum = nullptr;
|
||||||
glm::ivec4 _viewport{ 0, 0, 1, 1 };
|
glm::ivec4 _viewport{ 0, 0, 1, 1 };
|
||||||
|
|
Loading…
Reference in a new issue