SHARE
TWEET
Untitled
a guest
Dec 26th, 2014
181
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- public void initFramebuffers() {
- // Thickness buffer
- glBindFramebuffer(GL_FRAMEBUFFER, thicknessShader.fbo);
- thicknessShader.initTexture(width, height, GL_RGBA, GL_RGBA32F);
- glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, thicknessShader.tex, 0);
- }
- public void initTexture(int width, int height, int format, int internalFormat) {
- tex = glGenTextures();
- glBindTexture(GL_TEXTURE_2D, tex);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, width, height, 0, format, GL_FLOAT, (ByteBuffer)null);
- }
- //--------------------Particle Thickness-----------------------
- {
- glUseProgram(thicknessShader.program);
- glBindFramebuffer(GL_FRAMEBUFFER, thicknessShader.fbo);
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
- thicknessShader.particleThicknessVAO(points);
- RenderUtility.setMatrix(thicknessShader, mView, "mView");
- RenderUtility.setMatrix(thicknessShader, projection, "projection");
- RenderUtility.setVector2(thicknessShader, screenSize, "screenSize");
- glEnable(GL_BLEND);
- glBlendFunc(GL_ONE, GL_ONE);
- glBlendEquation(GL_FUNC_ADD);
- glDisable(GL_DEPTH_TEST);
- glBindVertexArray(thicknessShader.vao);
- glDrawArrays(GL_POINTS, 0, points.size());
- glDisable(GL_BLEND);
- }
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.

