syl wrote:thanks for your contrib![]()
is it tested with decalbatch ? i'm having an issue : blackscreen after a very short time when i see something. i tried different settings from the simple new Bloom(); to bloom = new Bloom(1024, 1024, true, true, true);
here is my screen code (it's just a simple test, based on decaltest)
- Code: Select all
package com.syl.test;
import java.util.LinkedList;
import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.Camera;
import com.badlogic.gdx.graphics.GL10;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.graphics.g3d.decals.Decal;
import com.badlogic.gdx.graphics.g3d.decals.DecalBatch;
import com.badlogic.gdx.graphics.g3d.decals.GroupStrategy;
import com.badlogic.gdx.graphics.g3d.decals.SimpleOrthoGroupStrategy;
import com.badlogic.gdx.graphics.glutils.ShaderProgram;
public class SplashScreen implements Screen {
private Bloom bloom;
public static final int TARGET_FPS = 40;
public static final int INITIAL_RENDERED = 100;
private boolean blending = true;
private GroupStrategy strategy = new GL20GroupStrategy();
//private GroupStrategy strategy = new SimpleOrthoGroupStrategy();
// private GroupStrategy strategy = new DefaultGroupStrategy();
Texture egg;
Texture wheel;
LinkedList<Decal> toRender = new LinkedList<Decal>();
DecalBatch batch;
Camera cam;
int idx = 0;
float wait = 30;
private Game test;
/**
* Constructor for the splash screen
* @param g Game which called this splash screen.
*/
public SplashScreen(Game g) {
test = g;
}
@Override public void render(float delta) {
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
for (Decal decal : toRender) {
decal.rotateZ(delta * 45);
batch.add(decal);
}
bloom.capture();
batch.flush();
bloom.render();
wait -= delta;
if (wait < 0 || Gdx.input.justTouched()) {
test.setScreen(new MenuScreen(test));
}
}
@Override public void resize(int width, int height) {
cam = new OrthographicCamera(width, height);
cam.near = 0.1f;
cam.far = 10f;
cam.position.set(0, 0, 0.1f);
cam.direction.set(0, 0, -1f);
cam.update();
if (Gdx.graphics.isGL20Available()) {
ShaderProgram shader = strategy.getGroupShader(0);
shader.begin();
shader.setUniformMatrix("u_projectionViewMatrix", cam.combined);
shader.setUniformi("u_texture", 0);
} else {
cam.apply((GL10)Gdx.gl);
}
}
@Override public void show() {
//bloom = new Bloom(); //too small can cause aliasing but is lot faster
bloom = new Bloom(Gdx.graphics.getWidth() / 4, Gdx.graphics.getHeight() / 4, false, false, true);
//bloom = new Bloom(1024, 1024, true, true, true);
Gdx.gl.glEnable(GL20.GL_DEPTH_TEST);
Gdx.gl20.glDepthFunc(GL20.GL_LESS);
egg = new Texture(Gdx.files.internal("egg.png"));
egg.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
egg.setWrap(Texture.TextureWrap.ClampToEdge, Texture.TextureWrap.ClampToEdge);
Decal egg_sprite = Decal.newDecal(new TextureRegion(egg), blending);
egg_sprite.setPosition(0, 256, -1);
toRender.add(egg_sprite);
wheel = new Texture(Gdx.files.internal("wheel.png"));
wheel.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
wheel.setWrap(Texture.TextureWrap.ClampToEdge, Texture.TextureWrap.ClampToEdge);
Decal wheel_sprite = Decal.newDecal(new TextureRegion(wheel), blending);
wheel_sprite.setPosition(256, 0, -2);
toRender.add(wheel_sprite);
batch = new DecalBatch(strategy);
Gdx.gl.glClearColor(1, 1, 0, 1);
}
@Override public void hide() {
}
@Override public void pause() {
}
@Override public void resume() {
bloom.resume();
}
@Override public void dispose() {
}
}
I'm using this GL20GroupStrategy viewtopic.php?f=11&t=2732&p=13977&hilit=GL20GroupStrategy#p13994
is it a problem or a conflict ?
Thanks
I don't know how those decals work but I would suggest you to start with minimal test case. If that does not work then its lot simpler to find problem. Usually black screen with openGl is just some openGL state that leaked and really hard to spot.
