diff --git a/android/assets/shaders/default_frag.glsl b/android/assets/shaders/default_frag.glsl new file mode 100755 index 0000000..7d6f868 --- /dev/null +++ b/android/assets/shaders/default_frag.glsl @@ -0,0 +1,16 @@ +#ifdef GL_ES +#define LOWP lowp + precision mediump float; +#else + #define LOWP +#endif + +varying LOWP vec4 v_color; +varying vec2 v_texCoords; + +uniform sampler2D u_texture; + +void main() +{ + gl_FragColor = v_color * texture2D(u_texture, v_texCoords); +} diff --git a/android/assets/shaders/default_vertex.glsl b/android/assets/shaders/default_vertex.glsl new file mode 100755 index 0000000..75fd649 --- /dev/null +++ b/android/assets/shaders/default_vertex.glsl @@ -0,0 +1,16 @@ +attribute vec4 a_position; +attribute vec4 a_color; +attribute vec2 a_texCoord; + +uniform mat4 u_projTrans; + +varying vec4 v_color; +varying vec2 v_texCoords; + +void main() +{ + v_color = a_color; + v_color.a = v_color.a * (256.0/255.0); + v_texCoords = a_texCoord + 0; + gl_Position = u_projTrans * a_position; +} diff --git a/android/assets/shaders/retro.glsl b/android/assets/shaders/retro.glsl deleted file mode 100755 index b5ae5f0..0000000 --- a/android/assets/shaders/retro.glsl +++ /dev/null @@ -1,4 +0,0 @@ -void main() -{ - gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); -} diff --git a/core/src/zero1hd/polyjet/Polyjet.java b/core/src/zero1hd/polyjet/Polyjet.java index d1ee508..cc81c55 100755 --- a/core/src/zero1hd/polyjet/Polyjet.java +++ b/core/src/zero1hd/polyjet/Polyjet.java @@ -18,6 +18,7 @@ import com.badlogic.gdx.graphics.g2d.ParticleEffect; import com.badlogic.gdx.graphics.g2d.TextureAtlas; import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator; import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator.FreeTypeFontParameter; +import com.badlogic.gdx.graphics.glutils.ShaderProgram; import com.badlogic.gdx.math.MathUtils; import com.badlogic.gdx.scenes.scene2d.ui.Button.ButtonStyle; import com.badlogic.gdx.scenes.scene2d.ui.CheckBox.CheckBoxStyle; @@ -50,6 +51,8 @@ public class Polyjet extends Game { TextureAtlas skinAtlas; private Preferences prefs; + public ShaderProgram defaultShader; + @Override public void create() { Gdx.app.setLogLevel(Application.LOG_DEBUG); @@ -86,6 +89,7 @@ public class Polyjet extends Game { assetManager.setLoader(ParticleEffect.class, new ParticleEffectLoader(genericFileFinder)); assetManager.setLoader(Sound.class, new SoundLoader(genericFileFinder)); + defaultShader = new ShaderProgram(Gdx.files.internal("shaders/default_vertex.glsl").readString(), Gdx.files.internal("shaders/default_frag.glsl").readString()); default_fontGenerator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/Gasalt-Regular.ttf")); darktech_ldr_fontGenerator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/darktech_ldr.ttf")); diff --git a/core/src/zero1hd/polyjet/screens/MainMenu.java b/core/src/zero1hd/polyjet/screens/MainMenu.java index d7ec4a0..5755b51 100755 --- a/core/src/zero1hd/polyjet/screens/MainMenu.java +++ b/core/src/zero1hd/polyjet/screens/MainMenu.java @@ -107,6 +107,7 @@ public class MainMenu extends ScreenAdapter implements TransitionAdapter { Gdx.gl.glClearColor(1f, 1f, 1f, 1f); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); stage.act(); + stage.draw(); if (stage.getCamera().position.x != targetPosition.x || stage.getCamera().position.y != targetPosition.y) { stage.getCamera().position.lerp(targetPosition, 0.25f);