weird rendering artifact

Started by raft, March 07, 2013, 11:44:20 PM

Previous topic - Next topic

EgonOlsen

Does it actually revert the depth test and blend settings?

raft


EgonOlsen

It enables gl_blend and disables gl_depth_test, but revertGLState doesn't seem to restore the former settings.

raft

no, Eclipse founds no more references to GL11.GL_BLEND and GL11.GL_DEPTH_TEST.

I've added the below code after TWL update and before FrameBuffer.update but didnt help
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_DEPTH_TEST);

EgonOlsen

Strange...have you tried to add dummy world and do a complete render/draw sequence with that one before the skybox?

raft

like this one? nope, didnt help :/

private void renderGame() {
dummyWorld.renderScene(buffer);
dummyWorld.draw(buffer);

skyBox.renderScene(buffer, game.world.getCamera().getBack());
skyBox.draw(buffer);
buffer.clearZBufferOnly();

game.world.renderScene(buffer);
game.world.draw(buffer);
}

EgonOlsen

Try to add some object to that world that would be visible, render it and clear the framebuffer after that...just to see if that fixes the gl states.

raft

like this? nope :(

World dummyWorld = new World();

{
Object3D box = Primitives.getBox(1,  1);
TextureManager.getInstance().addTexture("dummy", new Texture(64, 64, Color.BLUE));
box.setTexture("dummy");
box.translate(0, 0, 5);
dummyWorld.addObject(box);
dummyWorld.buildAllObjects();

}

private void renderGame() {
dummyWorld.renderScene(buffer);
dummyWorld.draw(buffer);
buffer.clear();

skyBox.renderScene(buffer, game.world.getCamera().getBack());
skyBox.draw(buffer);
buffer.clearZBufferOnly();

game.world.renderScene(buffer);
game.world.draw(buffer);
}

EgonOlsen

I've no idea then. Have you tried to run it on the different machine/OS or with the GUI disabled?

raft

no, not tried on other os/hw yet.

for trying with gui disabled, it's hard to say. since my game's input comes from twl, not from jPCT's keymapper.

* I have a command line switch which directly loads a level at the very start. flickering also happens then with same simptoms, without switching video mode, but only at initial rotation.
* I've tried binding a key to switch video mode without gui. never happened in my trials. gui displaying enabled or not. not sure murphy or?

EgonOlsen

I still fail to see the relation between the flickering and the rotation, because the render pipeline doesn't care about some code changing the camera's matrix or not. It will always execute the same commands.  It would be really interesting to see if this happens on another platform too. It might as well be a driver problem of some kind.

raft

possibly you are right.

two more things I tried but didnt help:
* scaled up sky box cube
* left camera fov as default in sky box

raft

this may be caused by blitting. while initial rotation, level name is blitted on screen. i've commented it out and never happened since then. since problem is undeterministic now, I cant be 100% sure, but seems as this is the reason.

text blitting uses the longest FrameBuffer.blit(..) method

after intro, lives and clock are also blitted but they use a different FrameBuffer.blit(..) method. if blitting is the cause, it must be related to first blit mehod.

EgonOlsen

The blit-methods all result in the same method being executed internally, so it shouldn't matter which one you are using. I've still no idea how this all plays together...have you tried to set Config.glBufferedBlits=true;? Does that change anything? Another thing to try: Comment out the blits and add a call to GL11.glFlush(); instead and see what happens then.

raft

Config.glBufferedBlits=true seems to help. never happened in 10 tries.

also with no blits and GL11.glFlush() never happened in 10 tries.