SHARE
TWEET

Untitled

a guest Dec 26th, 2014 181 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public void initFramebuffers() {
  2.         // Thickness buffer
  3.         glBindFramebuffer(GL_FRAMEBUFFER, thicknessShader.fbo);
  4.         thicknessShader.initTexture(width, height, GL_RGBA, GL_RGBA32F);
  5.         glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, thicknessShader.tex, 0);
  6. }
  7.  
  8. public void initTexture(int width, int height, int format, int internalFormat) {
  9.                 tex = glGenTextures();
  10.                 glBindTexture(GL_TEXTURE_2D, tex);
  11.                 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
  12.                 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
  13.                 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
  14.                 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
  15.                 glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, width, height, 0, format, GL_FLOAT, (ByteBuffer)null);
  16. }
  17.  
  18. //--------------------Particle Thickness-----------------------
  19. {
  20.         glUseProgram(thicknessShader.program);
  21.         glBindFramebuffer(GL_FRAMEBUFFER, thicknessShader.fbo);
  22.                                
  23.         glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  24.                                
  25.         thicknessShader.particleThicknessVAO(points);
  26.  
  27.         RenderUtility.setMatrix(thicknessShader, mView, "mView");
  28.         RenderUtility.setMatrix(thicknessShader, projection, "projection");
  29.         RenderUtility.setVector2(thicknessShader, screenSize, "screenSize");
  30.  
  31.         glEnable(GL_BLEND);
  32.         glBlendFunc(GL_ONE, GL_ONE);
  33.         glBlendEquation(GL_FUNC_ADD);
  34.         glDisable(GL_DEPTH_TEST);
  35.  
  36.         glBindVertexArray(thicknessShader.vao);
  37.  
  38.         glDrawArrays(GL_POINTS, 0, points.size());
  39.  
  40.         glDisable(GL_BLEND);
  41. }
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