SHARE
TWEET

Untitled

a guest Dec 26th, 2014 139 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //--------------------Particle Blur-------------------------
  2.                         {
  3.                                 glUseProgram(blurShader.program);
  4.                        
  5.                                 //Vertical blur
  6.                                 glBindFramebuffer(GL_FRAMEBUFFER, blurShader.fboV);
  7.                                 glDrawBuffer(GL_NONE);
  8.                                 glReadBuffer(GL_NONE);
  9.                                
  10.                                 glClear(GL_DEPTH_BUFFER_BIT);
  11.  
  12.                                 blurShader.blurDepthVAO();
  13.                                
  14.                                 glActiveTexture(GL_TEXTURE0);
  15.                                 glBindTexture(GL_TEXTURE_2D, depthShader.tex);
  16.                                 glUniform1i(blurShader.depthMap, 0);
  17.                                
  18.                                 RenderUtility.setVector2(blurShader, screenSize, "screenSize");
  19.                                 RenderUtility.setMatrix(blurShader, projection, "projection");
  20.                                 RenderUtility.setVector2(blurShader, new Vector2(0.0f, 1.0f / screenSize.y), "blurDir");
  21.                                
  22.                                 glEnable(GL_DEPTH_TEST);
  23.                                
  24.                                 glBindVertexArray(blurShader.vao);
  25.                                
  26.                                 glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
  27.                                
  28.                                 //Horizontal Blur
  29.                                 glBindFramebuffer(GL_FRAMEBUFFER, blurShader.fboH);
  30.                                 glDrawBuffer(GL_NONE);
  31.                                 glReadBuffer(GL_NONE);
  32.                                
  33.                                 glClear(GL_DEPTH_BUFFER_BIT);
  34.                                
  35.                                 glActiveTexture(GL_TEXTURE0);
  36.                                 glBindTexture(GL_TEXTURE_2D, blurShader.texV);
  37.                                 glUniform1i(blurShader.depthMap, 0);
  38.                                
  39.                                 RenderUtility.setVector2(blurShader, screenSize, "screenSize");
  40.                                 RenderUtility.setMatrix(blurShader, projection, "projection");
  41.                                 RenderUtility.setVector2(blurShader, new Vector2(1.0f / screenSize.x, 0.0f), "blurDir");
  42.                                
  43.                                 glEnable(GL_DEPTH_TEST);
  44.                                
  45.                                 glBindVertexArray(blurShader.vao);
  46.                                
  47.                                 glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
  48.                         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top