Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: Multiple Post Processing - FBO Bug?

Threaded View

  1. #1
    Intern Newbie
    Join Date
    Mar 2013
    Posts
    42

    Question Multiple Post Processing - FBO Bug?

    Hallo

    I implemented a multiple post processing shader support for my game, but now, i have the following bug:
    When i use and render my post processing shaders to the fbo texture, i become some strange half transparent lines. It looks like a blur effect or something else.

    Here a screenshot (On the left side from the black lines, i've added with paint, there are the strange half transparent lines!):
    In this example, i used my cartoon edge shader, and my bloom shader.
    Click image for larger version. 

Name:	Bug.jpg 
Views:	160 
Size:	21.0 KB 
ID:	1031
    I really hope you can see them ;-)
    You can see them pretty good on very bright textures!

    This is my multiple post processing code:
    Code :
    GL11.glDrawBuffer(GL11.GL_NONE);
    		GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, fbo);
     
    		usePostProcessingTexture(renderer.getSceneTexture(0));
     
    		List<Filter> filters = postprocessor.getFilterList();
     
    		for (Filter filter : filters) {
    			if ((filter instanceof PostProcessable) && !(filter instanceof PreProcessable)) {
    				filter.filter(screentexture, renderer.getDepthTexture(), renderer.getNormalTexture());
    				usePostProcessingTexture(screentexture);
    				((PostProcessable) filter).unuseFilter();
    			}
    		}
     
    		GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0);
    		GL11.glDrawBuffer(GL11.GL_BACK);
     
    		usePostProcessingTexture(screentexture);

    The following code, renders my post processed image to the screen.
    I think, the problem might be here:
    Code :
    /**
    	 * Uses the post processing texture.
    	 */
    	private void usePostProcessingTexture(int scene) {
    		GL13.glActiveTexture(GL13.GL_TEXTURE30);
    		GL11.glBindTexture(GL11.GL_TEXTURE_2D, scene);
    		GL11.glBegin(GL11.GL_QUADS);
    		{
    			GL11.glTexCoord2f(0, 1);
    			GL11.glVertex2f(0, 0);
     
    			GL11.glTexCoord2f(0, 0);
    			GL11.glVertex2f(0, Display.getHeight());
     
    			GL11.glTexCoord2f(1, 0);
    			GL11.glVertex2f(Display.getWidth(), Display.getHeight());
     
    			GL11.glTexCoord2f(1, 1);
    			GL11.glVertex2f(Display.getWidth(), 0);
    		}
    		GL11.glEnd();
    		GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);
    		GL13.glActiveTexture(GL13.GL_TEXTURE0);
    	}

    And this is my FBO initialization code:
    Code :
    screentexture = LwjglRenderer.createRenderableTexture();
     
    		fbo = GL30.glGenFramebuffers();
    		GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, fbo);
    		GL30.glFramebufferTexture2D(GL30.GL_FRAMEBUFFER, GL30.GL_COLOR_ATTACHMENT0, GL11.GL_TEXTURE_2D, screentexture, 0);
     
    		if (GL30.glCheckFramebufferStatus(GL30.GL_FRAMEBUFFER) != GL30.GL_FRAMEBUFFER_COMPLETE) {
    			throw new OpenGLException("Was not able to create framebuffer for post processing!");
    		}
     
    		GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0);

    This here:
    Code :
    LwjglRenderer.createRenderableTexture();
    Just creates a new texture:
    Code :
    /**
    	 * Creates a new renderable texture.
    	 *
    	 * @return Empty texture.
    	 */
    	public static int createRenderableTexture() {
    		int texture = glGenTextures();
    		glBindTexture(GL_TEXTURE_2D, texture);
    		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
    		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
    		glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, Display.getWidth(), Display.getHeight(), 0, GL_RGBA, GL_UNSIGNED_BYTE, (ByteBuffer) null);
    		return texture;
    	}

    The shaders are not the problem!
    I really hope, someone of you guys can help me

    MfG, Daniel!
    Last edited by Alphaomega86; 05-20-2013 at 01:11 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •