Java Code Examples for com.badlogic.gdx.graphics.GL20#GL_COLOR_BUFFER_BIT

The following examples show how to use com.badlogic.gdx.graphics.GL20#GL_COLOR_BUFFER_BIT . 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: LibgdxGraphics.java    From mini2Dx with Apache License 2.0 6 votes vote down vote up
@Override
public void clearContext(Color color, boolean depthBufferBit, boolean colorBufferBit) {
	int mask;
	if(depthBufferBit && colorBufferBit) {
		mask = GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT;
	} else if(depthBufferBit) {
		mask = GL20.GL_DEPTH_BUFFER_BIT;
	} else if(colorBufferBit) {
		mask = GL20.GL_COLOR_BUFFER_BIT;
	} else {
		mask = 0;
	}

	Gdx.gl.glClearColor(color.rf(), color.gf(), color.bf(), color.af());
	Gdx.gl.glClear(mask);
}
 
Example 2
Source File: GdxRenderer.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void clearBuffers(boolean color, boolean depth, boolean stencil) {
    int bits = 0;
    if (color) {
        bits = GL20.GL_COLOR_BUFFER_BIT;
    }
    if (depth) {
        bits |= GL20.GL_DEPTH_BUFFER_BIT;
        if (context.depthWriteEnabled == false) {
            Gdx.gl20.glDepthMask(true);
            context.depthWriteEnabled = true;
        }
    }
    if (stencil) {
        bits |= GL20.GL_STENCIL_BUFFER_BIT;
    }
    if (bits != 0) {
        if (verboseLogging) {
            logger.log(Level.INFO, "GLES20.glClear(color={0}, depth={1}, stencil={2})", new Object[]{color, depth, stencil});
        }
        Gdx.gl20.glClear(bits);
        checkGLError();
    }
}