Java Code Examples for javax.media.opengl.GL#glClear()

The following examples show how to use javax.media.opengl.GL#glClear() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BloomOpenGL.java    From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public void display(GLAutoDrawable glAutoDrawable) {
    GL gl = glAutoDrawable.getGL();
    gl.glLoadIdentity(); 
    gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
    gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
    viewOrtho(gl, image.getWidth(), image.getHeight());
    gl.glEnable(GL.GL_TEXTURE_2D);

    int width = image.getWidth();
    int height = image.getHeight();

    // Source Image/bright pass on FBO1
    renderBrightPass(gl, width, height);
    // Source image on FBO2
    renderImage(gl, width, height);
    // On screen
    renderTextureOnScreen(gl, width, height);

    //render5x5(gl, width, height);
    render11x11(gl, width, height);
    render21x21(gl, width, height);
    render41x41(gl, width, height);

    gl.glDisable(GL.GL_TEXTURE_2D);
    gl.glFlush();
}
 
Example 2
Source File: BloomOpenGL.java    From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private void renderBlur(GL gl, float width, float height) {
    // Draw into the FBO
    gl.glBindFramebufferEXT(GL.GL_FRAMEBUFFER_EXT, frameBufferObject2);
    gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
    gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);

    enableBlurFragmentProgram(gl, blurShader, width, height);
    gl.glBindTexture(GL.GL_TEXTURE_2D, frameBufferTexture1);

    renderTexturedQuad(gl, width, height, texture.getMustFlipVertically());

    gl.glBindTexture(GL.GL_TEXTURE_2D, 0);
    disableFragmentProgram(gl);

    gl.glBindFramebufferEXT(GL.GL_FRAMEBUFFER_EXT, 0);
}
 
Example 3
Source File: BloomOpenGL.java    From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void renderBrightPass(GL gl, float width, float height) {
    // Draw into the FBO
    gl.glBindFramebufferEXT(GL.GL_FRAMEBUFFER_EXT, frameBufferObject1);
    gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
    gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
    enableBrightPassFragmentProgram(gl, brightPassShader, threshold);
    gl.glBindTexture(GL.GL_TEXTURE_2D, texture.getTextureObject());

    renderTexturedQuad(gl, width, height, texture.getMustFlipVertically());

    gl.glBindTexture(GL.GL_TEXTURE_2D, 0);
    disableFragmentProgram(gl);

    gl.glBindFramebufferEXT(GL.GL_FRAMEBUFFER_EXT, 0);
}
 
Example 4
Source File: BloomOpenGL.java    From filthy-rich-clients with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void renderImage(GL gl, float width, float height) {
    // Draw into the FBO
    gl.glBindFramebufferEXT(GL.GL_FRAMEBUFFER_EXT, frameBufferObject2);
    gl.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
    gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);

    gl.glBindTexture(GL.GL_TEXTURE_2D, texture.getTextureObject());
    renderTexturedQuad(gl, width, height, texture.getMustFlipVertically());
    gl.glBindTexture(GL.GL_TEXTURE_2D, 0);

    gl.glBindFramebufferEXT(GL.GL_FRAMEBUFFER_EXT, 0);
}