Skip to content

Commit

Permalink
Added antialiasing flag to the ScreenUtils. (libgdx#7286)
Browse files Browse the repository at this point in the history
  • Loading branch information
GadWissberg authored Mar 7, 2024
1 parent e43b342 commit 3d8cfb8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions gdx/src/com/badlogic/gdx/utils/ScreenUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,19 @@ public static void clear (Color color, boolean clearDepth) {
/** Clears the color buffers and optionally the depth buffer.
* @param clearDepth Clears the depth buffer if true. */
public static void clear (float r, float g, float b, float a, boolean clearDepth) {
clear(r, g, b, a, clearDepth, false);
}

/** Clears the color buffers, optionally the depth buffer and whether to apply antialiasing (requires to set number of samples
* in the launcher class).
*
* @param clearDepth Clears the depth buffer if true.
* @param applyAntialiasing applies multi-sampling for antialiasing if true. */
public static void clear (float r, float g, float b, float a, boolean clearDepth, boolean applyAntialiasing) {
Gdx.gl.glClearColor(r, g, b, a);
int mask = GL20.GL_COLOR_BUFFER_BIT;
if (clearDepth) mask = mask | GL20.GL_DEPTH_BUFFER_BIT;
if (applyAntialiasing && Gdx.graphics.getBufferFormat().coverageSampling) mask = mask | GL20.GL_COVERAGE_BUFFER_BIT_NV;
Gdx.gl.glClear(mask);
}

Expand Down

0 comments on commit 3d8cfb8

Please sign in to comment.