Showing the changes to libraries/render-utils/src/DeferredLightingEffect.cpp (1 of 13 files). Show all
Unified · Split
| @@ -12,7 +12,6 @@ · 11 unmodified lines | |||
| 12 | // include this before QOpenGLFramebufferObject, which includes an earlier version of OpenGL | 12 | // include this before QOpenGLFramebufferObject, which includes an earlier version of OpenGL |
| 13 | #include <gpu/GPUConfig.h> | 13 | #include <gpu/GPUConfig.h> |
| 14 | 14 | ||
| 15 | #include <QOpenGLFramebufferObject> | ||
| 16 | 15 | ||
| 17 | #include <GLMHelpers.h> | 16 | #include <GLMHelpers.h> |
| 18 | #include <PathUtils.h> | 17 | #include <PathUtils.h> |
| @@ -183,12 +182,13 @@ void DeferredLightingEffect::render() { · 164 unmodified lines | |||
| 183 | 182 | ||
| 184 | auto textureCache = DependencyManager::get<TextureCache>(); | 183 | auto textureCache = DependencyManager::get<TextureCache>(); |
| 185 | 184 | ||
| 186 | // QOpenGLFramebufferObject* primaryFBO = textureCache->getPrimaryFramebufferObject(); | 185 | glBindFramebuffer(GL_FRAMEBUFFER, 0 ); |
| 187 | // primaryFBO->release(); | 186 | |
| 188 | QSize framebufferSize = textureCache->getFrameBufferSize(); | 187 | QSize framebufferSize = textureCache->getFrameBufferSize(); |
| 189 | 188 | ||
| 190 | QOpenGLFramebufferObject* freeFBO = DependencyManager::get<GlowEffect>()->getFreeFramebufferObject(); | 189 | auto freeFBO = DependencyManager::get<GlowEffect>()->getFreeFramebuffer(); |
| 191 | freeFBO->bind(); | 190 | glBindFramebuffer(GL_FRAMEBUFFER, gpu::GLBackend::getFramebufferID(freeFBO)); |
| 191 | |||
| 192 | glClear(GL_COLOR_BUFFER_BIT); | 192 | glClear(GL_COLOR_BUFFER_BIT); |
| 193 | // glEnable(GL_FRAMEBUFFER_SRGB); | 193 | // glEnable(GL_FRAMEBUFFER_SRGB); |
| 194 | 194 | ||
| @@ -211,11 +211,7 @@ void DeferredLightingEffect::render() { · 16 unmodified lines | |||
| 211 | const int VIEWPORT_Y_INDEX = 1; | 211 | const int VIEWPORT_Y_INDEX = 1; |
| 212 | const int VIEWPORT_WIDTH_INDEX = 2; | 212 | const int VIEWPORT_WIDTH_INDEX = 2; |
| 213 | const int VIEWPORT_HEIGHT_INDEX = 3; | 213 | const int VIEWPORT_HEIGHT_INDEX = 3; |
| 214 | /* float sMin = viewport[VIEWPORT_X_INDEX] / (float)primaryFBO->width(); | 214 | |
| 215 | float sWidth = viewport[VIEWPORT_WIDTH_INDEX] / (float)primaryFBO->width(); | ||
| 216 | float tMin = viewport[VIEWPORT_Y_INDEX] / (float)primaryFBO->height(); | ||
| 217 | float tHeight = viewport[VIEWPORT_HEIGHT_INDEX] / (float)primaryFBO->height(); | ||
| 218 | */ | ||
| 219 | float sMin = viewport[VIEWPORT_X_INDEX] / (float)framebufferSize.width(); | 215 | float sMin = viewport[VIEWPORT_X_INDEX] / (float)framebufferSize.width(); |
| 220 | float sWidth = viewport[VIEWPORT_WIDTH_INDEX] / (float)framebufferSize.width(); | 216 | float sWidth = viewport[VIEWPORT_WIDTH_INDEX] / (float)framebufferSize.width(); |
| 221 | float tMin = viewport[VIEWPORT_Y_INDEX] / (float)framebufferSize.height(); | 217 | float tMin = viewport[VIEWPORT_Y_INDEX] / (float)framebufferSize.height(); |
| @@ -436,7 +432,9 @@ void DeferredLightingEffect::render() { · 214 unmodified lines | |||
| 436 | glActiveTexture(GL_TEXTURE0); | 432 | glActiveTexture(GL_TEXTURE0); |
| 437 | glBindTexture(GL_TEXTURE_2D, 0); | 433 | glBindTexture(GL_TEXTURE_2D, 0); |
| 438 | 434 | ||
| 439 | freeFBO->release(); | 435 | //freeFBO->release(); |
| 436 | glBindFramebuffer(GL_FRAMEBUFFER, 0); | ||
| 437 | |||
| 440 | // glDisable(GL_FRAMEBUFFER_SRGB); | 438 | // glDisable(GL_FRAMEBUFFER_SRGB); |
| 441 | 439 | ||
| 442 | glDisable(GL_CULL_FACE); | 440 | glDisable(GL_CULL_FACE); |
| @@ -445,12 +443,12 @@ void DeferredLightingEffect::render() { · 2 unmodified lines | |||
| 445 | glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_CONSTANT_ALPHA, GL_ONE); | 443 | glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_CONSTANT_ALPHA, GL_ONE); |
| 446 | glColorMask(true, true, true, false); | 444 | glColorMask(true, true, true, false); |
| 447 | 445 | ||
| 448 | auto primaryFBO = gpu::GLBackend::getFramebufferID(textureCache->getPrimaryOpaqueFramebuffer()); | 446 | auto primaryFBO = gpu::GLBackend::getFramebufferID(textureCache->getPrimaryFramebuffer()); |
| 449 | glBindFramebuffer(GL_DRAW_FRAMEBUFFER, primaryFBO); | 447 | glBindFramebuffer(GL_DRAW_FRAMEBUFFER, primaryFBO); |
| 450 | 448 | ||
| 451 | //primaryFBO->bind(); | 449 | //primaryFBO->bind(); |
| 452 | 450 | ||
| 453 | glBindTexture(GL_TEXTURE_2D, freeFBO->texture()); | 451 | glBindTexture(GL_TEXTURE_2D, gpu::GLBackend::getTextureID(freeFBO->getRenderBuffer(0))); |
| 454 | glEnable(GL_TEXTURE_2D); | 452 | glEnable(GL_TEXTURE_2D); |
| 455 | 453 | ||
| 456 | glPushMatrix(); | 454 | glPushMatrix(); |