Author Topic: weird rendering artifact  (Read 3814 times)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: weird rendering artifact
« Reply #15 on: March 08, 2013, 05:53:19 pm »
Does it actually revert the depth test and blend settings?

Offline raft

  • quad
  • ******
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: weird rendering artifact
« Reply #16 on: March 08, 2013, 05:55:37 pm »
excuse me?  ::)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: weird rendering artifact
« Reply #17 on: March 08, 2013, 05:59:54 pm »
It enables gl_blend and disables gl_depth_test, but revertGLState doesn't seem to restore the former settings.

Offline raft

  • quad
  • ******
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: weird rendering artifact
« Reply #18 on: March 08, 2013, 06:07:23 pm »
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
Code: [Select]
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_DEPTH_TEST);

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: weird rendering artifact
« Reply #19 on: March 08, 2013, 07:31:59 pm »
Strange...have you tried to add dummy world and do a complete render/draw sequence with that one before the skybox?

Offline raft

  • quad
  • ******
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: weird rendering artifact
« Reply #20 on: March 08, 2013, 07:41:46 pm »
like this one? nope, didnt help :/

Code: [Select]
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);
}

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: weird rendering artifact
« Reply #21 on: March 08, 2013, 09:19:46 pm »
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.

Offline raft

  • quad
  • ******
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: weird rendering artifact
« Reply #22 on: March 09, 2013, 05:19:45 pm »
like this? nope :(

Code: [Select]
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);
}

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: weird rendering artifact
« Reply #23 on: March 09, 2013, 05:37:37 pm »
I've no idea then. Have you tried to run it on the different machine/OS or with the GUI disabled?

Offline raft

  • quad
  • ******
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: weird rendering artifact
« Reply #24 on: March 09, 2013, 06:24:12 pm »
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?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: weird rendering artifact
« Reply #25 on: March 09, 2013, 08:52:24 pm »
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.

Offline raft

  • quad
  • ******
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: weird rendering artifact
« Reply #26 on: March 10, 2013, 05:01:04 pm »
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

Offline raft

  • quad
  • ******
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: weird rendering artifact
« Reply #27 on: March 10, 2013, 08:00:36 pm »
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.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11745
    • View Profile
    • http://www.jpct.net
Re: weird rendering artifact
« Reply #28 on: March 10, 2013, 09:43:35 pm »
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.

Offline raft

  • quad
  • ******
  • Posts: 1966
    • View Profile
    • http://www.aptalkarga.com
Re: weird rendering artifact
« Reply #29 on: March 10, 2013, 10:07:58 pm »
Config.glBufferedBlits=true seems to help. never happened in 10 tries.

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