@@ -423,6 +423,42 @@ void display()
|
|
423
423
|
|
424
424
|
labhelper::drawFullScreenQuad();
|
425
425
|
}
|
426
|
+
if(currentEffect == PostProcessingEffect::Bloom)
|
427
|
+
{
|
428
|
+
// cutoff shader
|
429
|
+
FboInfo& cutoffFbo = fboList[2];
|
430
|
+
glBindFramebuffer(GL_FRAMEBUFFER, cutoffFbo.framebufferId);
|
431
|
+
glViewport(0, 0, cutoffFbo.width, cutoffFbo.height);
|
432
|
+
glClear(GL_DEPTH_BUFFER_BIT);
|
433
|
+
|
434
|
+
glUseProgram(cutoffShader);
|
435
|
+
glActiveTexture(GL_TEXTURE0);
|
436
|
+
glBindTexture(GL_TEXTURE_2D, cameraFB.colorTextureTarget);
|
437
|
+
|
438
|
+
labhelper::drawFullScreenQuad();
|
439
|
+
|
440
|
+
// horizontal blur
|
441
|
+
glBindFramebuffer(GL_FRAMEBUFFER, horizontalBlurFbo.framebufferId);
|
442
|
+
glViewport(0, 0, horizontalBlurFbo.width, horizontalBlurFbo.height);
|
443
|
+
glClear(GL_DEPTH_BUFFER_BIT);
|
444
|
+
|
445
|
+
glUseProgram(horizontalBlurShader);
|
446
|
+
glActiveTexture(GL_TEXTURE0);
|
447
|
+
glBindTexture(GL_TEXTURE_2D, cutoffFbo.colorTextureTarget);
|
448
|
+
|
449
|
+
labhelper::drawFullScreenQuad();
|
450
|
+
|
451
|
+
// vertical blur
|
452
|
+
glBindFramebuffer(GL_FRAMEBUFFER, verticalBlurFbo.framebufferId);
|
453
|
+
glViewport(0, 0, verticalBlurFbo.width, verticalBlurFbo.height);
|
454
|
+
glClear(GL_DEPTH_BUFFER_BIT);
|
455
|
+
|
456
|
+
glUseProgram(verticalBlurShader);
|
457
|
+
glActiveTexture(GL_TEXTURE0);
|
458
|
+
glBindTexture(GL_TEXTURE_2D, horizontalBlurFbo.colorTextureTarget);
|
459
|
+
|
460
|
+
labhelper::drawFullScreenQuad();
|
461
|
+
}
|
426
462
|
|
427
463
|
// Task 4: Set the required uniforms
|
428
464
|
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
@@ -84,7 +84,8 @@ void main()
|
|
84
84
|
fragmentColor = textureRect(blurredFrameBufferTexture, gl_FragCoord.xy);
|
85
85
|
break;
|
86
86
|
case 8:
|
87
|
-
fragmentColor =
|
87
|
+
fragmentColor = textureRect(frameBufferTexture, gl_FragCoord.xy)
|
88
|
+
+ textureRect(blurredFrameBufferTexture, gl_FragCoord.xy);
|
88
89
|
break;
|
89
90
|
case 9:
|
90
91
|
fragmentColor = vec4(0.0); // place holder
|