Skip to content

Commit

Permalink
Merge pull request #3792 from realitix/correct_shadow_hdpi
Browse files Browse the repository at this point in the history
Fix shadow system for HDPI monitor, see #3702
  • Loading branch information
xoppa committed Jan 28, 2016
2 parents bfb37af + 6a6bd09 commit ea1f440
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,9 @@ protected void processViewport (LightProperties lp, boolean cameraViewport) {

TextureRegion region = lp.region;
region.setTexture(frameBuffers[currentPass].getColorBufferTexture());

// We don't use HdpiUtils
// gl commands related to shadow map size and not to screen size
Gdx.gl.glViewport(r.x, r.y, r.width, r.height);
Gdx.gl.glScissor(r.x + 1, r.y + 1, r.width - 2, r.height - 2);
region.setRegion(r.x, r.y, r.width, r.height);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
* }
* system.end();
*
* Gdx.gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
* HdpiUtils.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
* Gdx.gl.glClearColor(0, 0, 0, 1);
* Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ protected void init1 () {
}

protected void init2 () {
frameBuffers[SECOND_PASS] = new FrameBuffer(Pixmap.Format.RGBA8888, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), true);
frameBuffers[SECOND_PASS] = new FrameBuffer(Pixmap.Format.RGBA8888, Gdx.graphics.getBackBufferWidth(), Gdx.graphics.getBackBufferHeight(), true);
passShaderProviders[SECOND_PASS] = new Pass2ShaderProvider(new Pass2Shader.Config(this));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void set (BaseShader shader, int inputID, Renderable renderable, Attribut
@Override
public void set (BaseShader shader, int inputID, Renderable renderable, Attributes combinedAttributes) {
// Value must be float type to work !
shader.set(inputID, (float)Gdx.graphics.getWidth(), (float)Gdx.graphics.getHeight());
shader.set(inputID, (float)Gdx.graphics.getBackBufferWidth(), (float)Gdx.graphics.getBackBufferHeight());
}
};
}
Expand Down

0 comments on commit ea1f440

Please sign in to comment.