www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: raft on March 07, 2013, 11:44:20 pm

Title: weird rendering artifact
Post by: raft on March 07, 2013, 11:44:20 pm
i've faced a weird rendering artifact which I couldnt still find a reason. please see the video below:

aptalkarga.com/tmp/skymaze_weird.avi (http://aptalkarga.com/tmp/skymaze_weird.avi)

this only and only happens, when resolution is changed (FrameBuffer is recreated) during initial intro rotation and rotation is resumed afterwards. while capturing video somehow it ended prematurely but in real case always ends when rotation stops. does not happen if rotation is restarted or display changed after rotation. ends immediately if rotation is stopped manually.

seems like a multi threading issue but I see no reason for that. all gui code is rendered in GL thread.

really weird, any ideas?
Title: Re: weird rendering artifact
Post by: EgonOlsen on March 08, 2013, 07:56:20 am
That's strange...i don't see any relation between changing the framebuffer and the rotation. What rotates actually? The camera or the objects?
Title: Re: weird rendering artifact
Post by: raft on March 08, 2013, 12:33:33 pm
camera. it moves in a circular path and looks at circle center
Title: Re: weird rendering artifact
Post by: EgonOlsen on March 08, 2013, 02:20:07 pm
Actually, changing the framebuffer while the application is running isn't fully supported. When using compiled objects, there might be problems to recover from this. However, if you don't use compiled objects (or no VBOs/display lists), it should actually work fine and in my test case, it does. And in no case, it should give you this strange flickering...

I'll post my simple test case here. It uses a way to resize the FrameBuffer instead of destroying and recreating it. That's the better way because it preserves the context and avoids crashes when disposing a framebuffer that can occur on some NVidia cards under Windows.

Please tell me how it works:

Code: [Select]
import java.awt.Color;

import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;

import com.threed.jpct.*;
import com.threed.jpct.util.Light;


public class SwitchTest
{
  private static final long serialVersionUID = 1L;
  private FrameBuffer fb = null;
  private World world = null;
  private Object3D plane = null;
  private Object3D ramp = null;
  private Object3D cube2 = null;
  private Object3D sphere = null;


  public SwitchTest()
  {
  //
  }


  private void initStuff()
  {
    fb = new FrameBuffer(640, 480, FrameBuffer.SAMPLINGMODE_NORMAL);
    world = new World();
    fb.disableRenderer(IRenderer.RENDERER_SOFTWARE);
    fb.enableRenderer(IRenderer.RENDERER_OPENGL);

    ramp = Primitives.getCube(20);
    ramp.setAdditionalColor(Color.RED);
    plane = Primitives.getPlane(20, 10);
    plane.setAdditionalColor(Color.GREEN);
    sphere = Primitives.getSphere(30);
    sphere.setAdditionalColor(Color.CYAN);
    sphere.translate(-50, 10, 50);
    cube2 = Primitives.getCube(20);
    cube2.setAdditionalColor(Color.ORANGE);
    cube2.translate(60, -20, 60);

    plane.rotateX((float) Math.PI / 2f);
    ramp.rotateX((float) Math.PI / 2f);

    plane.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
    ramp.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
    sphere.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
    cube2.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);

    world.addObject(plane);
    world.addObject(ramp);
    world.addObject(sphere);
    world.addObject(cube2);

    Light light = new Light(world);
    light.setPosition(new SimpleVector(0, -80, 0));
    light.setIntensity(255, 130, 140);
    light.setAttenuation(-1);

    plane.compile();
    ramp.compile();
    sphere.compile();
    cube2.compile();

    world.setAmbientLight(10, 10, 10);
    world.buildAllObjects();
  }


  private void doIt()
    throws Exception
  {
    Camera cam = world.getCamera();
    cam.moveCamera(Camera.CAMERA_MOVEOUT, 100);
    cam.moveCamera(Camera.CAMERA_MOVEUP, 160);
    cam.lookAt(plane.getTransformedCenter());

    long s = System.currentTimeMillis();
    boolean changed = false;

    while (!Display.isCloseRequested())
    {
      if (System.currentTimeMillis() - s >= 2000 && !changed)
      {
        fb.resize(800, 600);
        Display.setDisplayMode(findMode(800, 600, Config.glColorDepth, Config.glZBufferDepth));
        changed = true;
      }

      fb.clear(Color.BLUE);
      world.renderScene(fb);
      world.draw(fb);
      fb.update();
      fb.display(null);
      world.getCamera().rotateZ(0.01f);
      Thread.sleep(10);
    }
  }


  public static void main(String[] args)
    throws Exception
  {
    SwitchTest cd = new SwitchTest();
    cd.initStuff();
    cd.doIt();
  }


  private DisplayMode findMode(int x, int y, int cbpp, int zbppm)
    throws Exception
  {
    int mode = -1;
    DisplayMode[] modes = Display.getAvailableDisplayModes();

    String os = System.getProperty("os.name");
    if (os != null && os.toLowerCase().indexOf("linux") != -1)
    {
      if (cbpp == 32)
      {
        cbpp = 24;
        Logger.log("Running on Linux with a 32bit color setting...adjusting to 24bit instead!");
      }
    }

    for (int i = 0; i < modes.length; i++)
    {
      if (modes[i].getWidth() == x && modes[i].getHeight() == y && modes[i].getBitsPerPixel() == cbpp
          && (Config.glRefresh == 0 || modes[i].getFrequency() == Config.glRefresh || !Config.glFullscreen))
      {
        mode = i;
        break;
      }
    }
    if (mode == -1)
    {
      for (int i = 0; i < modes.length; i++)
      {
        if (modes[i].getWidth() == x && modes[i].getHeight() == y && modes[i].getBitsPerPixel() >= cbpp
            && (modes[i].getFrequency() >= Config.glRefresh || !Config.glFullscreen))
        {
          mode = i;
          break;
        }
      }
      if (mode == -1)
      {
        for (int i = 0; i < modes.length; i++)
        {
          if (modes[i].getWidth() == x && modes[i].getHeight() == y)
          {
            mode = i;
            break;
          }
        }
      }

      if (mode == -1)
      {
        return null;
      }
    }
    return modes[mode];
  }
}


Title: Re: weird rendering artifact
Post by: raft on March 08, 2013, 02:50:21 pm
it works ok. no flickering at all. i tried same technique in my game but didnt help.

I've noticed someting which is not very noticable in the video. flickering happens only for SkyBox (my own skybox, not the jPCT's one). I've removed skybox rendering and flickering has gone. i've also tried removing FrameBuffer.clearZBufferOnly() call after skybox rendering but didnt help flickering.

btw, is it possible to go fullscreen without recreating FrameBuffer?
Title: Re: weird rendering artifact
Post by: EgonOlsen on March 08, 2013, 02:56:28 pm
btw, is it possible to go fullscreen without recreating FrameBuffer?
Yes, you could do something like:

Code: [Select]
if (System.currentTimeMillis() - s >= 2000 && !changed)
      {
        fb.resize(800, 600);
        Config.glFullscreen = true;
        Display.setDisplayModeAndFullscreen(findMode(800, 600, Config.glColorDepth, Config.glZBufferDepth));
        changed = true;
      }

In Eclipse and with my test case, this somehow causes the null pointer in the awt event dispatch thread. No idea why, but it should be possible to avoid that (or ignore it...).
Title: Re: weird rendering artifact
Post by: EgonOlsen on March 08, 2013, 02:57:03 pm
I've noticed someting which is not very noticable in the video. flickering happens only for SkyBox (my own skybox, not the jPCT's one). I've removed skybox rendering and flickering has gone. i've also tried removing FrameBuffer.clearZBufferOnly() call after skybox rendering but didnt help flickering.
Have you tried with jPCT's skybox implementation instead?
Title: Re: weird rendering artifact
Post by: raft on March 08, 2013, 03:46:45 pm
Have you tried with jPCT's skybox implementation instead?
yes, now tried, didnt help.

i've noticed this doesnt happen for all levels. seems as (but not 100% sure) happens when an excessive amount of particles used. like the levels with many lava tiles.
Title: Re: weird rendering artifact
Post by: EgonOlsen on March 08, 2013, 04:11:35 pm
Can you post the log output?
Title: Re: weird rendering artifact
Post by: raft on March 08, 2013, 04:33:49 pm
sure, here it is:

btw, I set Config.glRefresh to 0, to let jPCT pick a mode

Code: [Select]
...
Loading Texture...from InputStream
Expanding buffers...200000 bytes
Loading Texture...from InputStream
...
Java version is: 1.6.0_13
-> support for BufferedImage
Version helper for 1.5+ initialized!
-> using BufferedImage
Software renderer (OpenGL mode) initialized
Software renderer disposed
Current mode:1024 x 768 x 32 @72Hz
Driver is: igdumdx32/8.15.10.1892 on ATI Technologies Inc. / ATI Mobility FireGL V5700
GL_ARB_texture_env_combine supported and used!
FBO supported and used!
VBO supported and used!
OpenGL renderer initialized (using 4 texture stages)
08.Mar.2013 17:30:20 raft.jumpy.gl.JumpyTWL loadLevel
INFO: loading level: 0
Software renderer disposed
08.Mar.2013 17:30:21 raft.jumpy.gl.JumpyTWL render
INFO: disposing game
No octree found in serialized data!
No octree found in serialized data!
No octree found in serialized data!
No octree found in serialized data!
No octree found in serialized data!
No octree found in serialized data!
08.Mar.2013 17:30:21 raft.jumpy.gl.JumpyTWL$4 run
INFO: level loaded: 0
No octree found in serialized data!
No octree found in serialized data!
No octree found in serialized data!
No octree found in serialized data!
No octree found in serialized data!
New WorldProcessor created using 1 thread(s) and granularity of 1!
Creating new world processor buffer for thread main
New WorldProcessor created using 1 thread(s) and granularity of 1!
Creating new world processor buffer for thread main
08.Mar.2013 17:30:28 raft.jumpy.gl.JumpyTWL applyOptions
INFO: changing videomode to Resolution: 960x600x32 -- ZBuffer depth: 24 @ 60Hz
recreateFrameBuffer
08.Mar.2013 17:30:28 raft.jumpy.gl.Options saveNow
INFO: saved options
OpenGL renderer disposed
Visibility lists disposed!
Visibility lists disposed!
Java version is: 1.6.0_13
-> support for BufferedImage
Version helper for 1.5+ initialized!
-> using BufferedImage
Software renderer (OpenGL mode) initialized
Software renderer disposed
Current mode:960 x 600 x 32 @60Hz
Driver is: igdumdx32/8.15.10.1892 on ATI Technologies Inc. / ATI Mobility FireGL V5700
GL_ARB_texture_env_combine supported and used!
FBO supported and used!
VBO supported and used!
OpenGL renderer initialized (using 4 texture stages)
Software renderer disposed
08.Mar.2013 17:30:30 raft.jumpy.gl.Options saveNow
INFO: saved options
New WorldProcessor created using 1 thread(s) and granularity of 1!
08.Mar.2013 17:30:37 raft.jumpy.gl.JumpyTWL render
INFO: disposing game
Creating new world processor buffer for thread main
New WorldProcessor created using 1 thread(s) and granularity of 1!
Creating new world processor buffer for thread main
OpenGL renderer disposed
Visibility lists disposed!
Visibility lists disposed!
Visibility lists disposed!

Title: Re: weird rendering artifact
Post by: raft on March 08, 2013, 04:51:07 pm
btw, I guess this findMode code is used in engine, right? then I would suggest using

Code: [Select]
os.toLowerCase(Locale.ENGLISH).indexOf("linux")
instead of

Code: [Select]
os.toLowerCase().indexOf("linux")
since for example in turkish, LINUX's lowecase will be lınux, not linux
Title: Re: weird rendering artifact
Post by: EgonOlsen on March 08, 2013, 05:22:54 pm
since for example in turkish, LINUX's lowecase will be lınux, not linux
Interesting... ;)...i'll change it.

About the actual problem: I've no idea. I extended the test case to feature a skybox and 4000 "particles", but i still can't reproduce the problem:

Code: [Select]
import java.awt.Color;
import java.util.Locale;

import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.DisplayMode;

import com.threed.jpct.*;
import com.threed.jpct.util.Light;
import com.threed.jpct.util.SkyBox;

public class SwitchTest {
private static final long serialVersionUID = 1L;

private FrameBuffer fb = null;

private World world = null;

private Object3D plane = null;

private Object3D ramp = null;

private Object3D cube2 = null;

private Object3D sphere = null;

private Object3D bb = null;

private Object3D[] planes = new Object3D[4000];

private SkyBox sky = null;

public SwitchTest() {
//
}

private void initStuff() {
fb = new FrameBuffer(640, 480, FrameBuffer.SAMPLINGMODE_NORMAL);
world = new World();
fb.disableRenderer(IRenderer.RENDERER_SOFTWARE);
fb.enableRenderer(IRenderer.RENDERER_OPENGL);

ramp = Primitives.getCube(20);
ramp.setAdditionalColor(Color.RED);
plane = Primitives.getPlane(20, 10);
plane.setAdditionalColor(Color.GREEN);
sphere = Primitives.getSphere(30);
sphere.setAdditionalColor(Color.CYAN);
sphere.translate(-50, 10, 50);
cube2 = Primitives.getCube(20);
cube2.setAdditionalColor(Color.ORANGE);
cube2.translate(60, -20, 60);

plane.rotateX((float) Math.PI / 2f);
ramp.rotateX((float) Math.PI / 2f);

plane.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
ramp.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
sphere.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
cube2.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);

world.addObject(plane);
world.addObject(ramp);
world.addObject(sphere);
world.addObject(cube2);

Light light = new Light(world);
light.setPosition(new SimpleVector(0, -80, 0));
light.setIntensity(255, 130, 140);
light.setAttenuation(-1);

plane.compile();
ramp.compile();
sphere.compile();
cube2.compile();

world.setAmbientLight(10, 10, 10);
world.buildAllObjects();

TextureManager tm = TextureManager.getInstance();
tm.addTexture("left", new Texture(64, 64, Color.RED));
tm.addTexture("front", new Texture(64, 64, Color.GRAY));
tm.addTexture("right", new Texture(64, 64, Color.GREEN));
tm.addTexture("back", new Texture(64, 64, Color.YELLOW));
tm.addTexture("up", new Texture(64, 64, Color.MAGENTA));
tm.addTexture("down", new Texture(64, 64, Color.ORANGE));

sky = new SkyBox(800);

bb = Primitives.getPlane(1, 2);
for (int i = 0; i < planes.length; i++) {
Object3D tmp = bb.cloneObject();
tmp.compile();
tmp.shareCompiledData(bb);
tmp.build();
tmp.addParent(bb);
tmp.setBillboarding(true);
tmp.setAdditionalColor((int) (255f * Math.random()), (int) (255f * Math.random()), (int) (255f * Math.random()));
world.addObject(tmp);
tmp.translate(-100f + 200f * (float) Math.random(), -100f * (float) Math.random(), -100f + 200f * (float) Math.random());
}

}

private void doIt() throws Exception {
Camera cam = world.getCamera();
cam.moveCamera(Camera.CAMERA_MOVEOUT, 250);
cam.moveCamera(Camera.CAMERA_MOVEUP, 160);
cam.lookAt(plane.getTransformedCenter());

long s = System.currentTimeMillis();
boolean changed = false;

while (!Display.isCloseRequested()) {
if (System.currentTimeMillis() - s >= 2000 && !changed) {
fb.resize(800, 600);
Display.setDisplayMode(findMode(800, 600, Config.glColorDepth, Config.glZBufferDepth));
changed = true;
}

fb.clear(Color.BLUE);
sky.render(world, fb);
world.renderScene(fb);
world.draw(fb);
fb.update();
fb.display(null);
bb.rotateY(0.1f);
world.getCamera().rotateZ(0.01f);
}
}

public static void main(String[] args) throws Exception {
SwitchTest cd = new SwitchTest();
cd.initStuff();
cd.doIt();
}

private DisplayMode findMode(int x, int y, int cbpp, int zbppm) throws Exception {
int mode = -1;
DisplayMode[] modes = Display.getAvailableDisplayModes();

String os = System.getProperty("os.name");
if (os != null && os.toLowerCase(Locale.ENGLISH).indexOf("linux") != -1) {
if (cbpp == 32) {
cbpp = 24;
Logger.log("Running on Linux with a 32bit color setting...adjusting to 24bit instead!");
}
}

for (int i = 0; i < modes.length; i++) {
if (modes[i].getWidth() == x && modes[i].getHeight() == y && modes[i].getBitsPerPixel() == cbpp
&& (Config.glRefresh == 0 || modes[i].getFrequency() == Config.glRefresh || !Config.glFullscreen)) {
mode = i;
break;
}
}
if (mode == -1) {
for (int i = 0; i < modes.length; i++) {
if (modes[i].getWidth() == x && modes[i].getHeight() == y && modes[i].getBitsPerPixel() >= cbpp && (modes[i].getFrequency() >= Config.glRefresh || !Config.glFullscreen)) {
mode = i;
break;
}
}
if (mode == -1) {
for (int i = 0; i < modes.length; i++) {
if (modes[i].getWidth() == x && modes[i].getHeight() == y) {
mode = i;
break;
}
}
}

if (mode == -1) {
return null;
}
}
return modes[mode];
}
}


Can you reproduce this problem on another machine?
Title: Re: weird rendering artifact
Post by: raft on March 08, 2013, 05:24:58 pm
I've fully implemented switching resolution and fullscreen mode without recreating the FrameBuffer. and the problem mostly gone, it's undeterministic now and happens seldomly :o (switching mode is much more smoother now, thanks for the tip ;))

the main difference from previous try is notifying TWL renderer that display size changed.

does it make any difference where Display is resized? I mean before calling FrameBuffer.display(..) or after or anywhere else?

Title: Re: weird rendering artifact
Post by: EgonOlsen on March 08, 2013, 05:27:50 pm
does it make any difference where Display is resized? I mean before calling FrameBuffer.display(..) or after or anywhere else?
I'm not sure. I would place it at the beginning of the render loop.
Title: Re: weird rendering artifact
Post by: raft on March 08, 2013, 05:38:34 pm
I'm not sure. I would place it at the beginning of the render loop.
yes, I do the same..

I suspect this flickering happens due to some mismatch between jPCT and TWL settings.

below is what TWL does at start and end of each cycle. there is also clipping via GL11.glScissor if clipping is enabled for widgets.

Code: [Select]
    protected void setupGLState() {
        GL11.glPushAttrib(GL11.GL_ENABLE_BIT|GL11.GL_TRANSFORM_BIT|GL11.GL_HINT_BIT|
                GL11.GL_COLOR_BUFFER_BIT|GL11.GL_SCISSOR_BIT|GL11.GL_LINE_BIT|GL11.GL_TEXTURE_BIT);
        GL11.glMatrixMode(GL11.GL_PROJECTION);
        GL11.glPushMatrix();
        GL11.glLoadIdentity();
        GL11.glOrtho(0, width, height, 0, -1.0, 1.0);
        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        GL11.glPushMatrix();
        GL11.glLoadIdentity();
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glEnable(GL11.GL_LINE_SMOOTH);
        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_SCISSOR_TEST);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);
    }
   
    protected void revertGLState() {
        GL11.glPopMatrix();
        GL11.glMatrixMode(GL11.GL_PROJECTION);
        GL11.glPopMatrix();
        GL11.glPopAttrib();
    }
Title: Re: weird rendering artifact
Post by: EgonOlsen on March 08, 2013, 05:53:19 pm
Does it actually revert the depth test and blend settings?
Title: Re: weird rendering artifact
Post by: raft on March 08, 2013, 05:55:37 pm
excuse me?  ::)
Title: Re: weird rendering artifact
Post by: EgonOlsen 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.
Title: Re: weird rendering artifact
Post by: raft 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);
Title: Re: weird rendering artifact
Post by: EgonOlsen 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?
Title: Re: weird rendering artifact
Post by: raft 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);
}
Title: Re: weird rendering artifact
Post by: EgonOlsen 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.
Title: Re: weird rendering artifact
Post by: raft 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);
}
Title: Re: weird rendering artifact
Post by: EgonOlsen 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?
Title: Re: weird rendering artifact
Post by: raft 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?
Title: Re: weird rendering artifact
Post by: EgonOlsen 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.
Title: Re: weird rendering artifact
Post by: raft 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
Title: Re: weird rendering artifact
Post by: raft 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(..) (http://www.jpct.net/doc/com/threed/jpct/FrameBuffer.html#blit(com.threed.jpct.Texture, int, int, int, int, int, int, int, int, int, boolean, java.awt.Color)) method

after intro, lives and clock are also blitted but they use a different FrameBuffer.blit(..) (http://www.jpct.net/doc/com/threed/jpct/FrameBuffer.html#blit(com.threed.jpct.Texture, int, int, int, int, int, int, boolean)) method. if blitting is the cause, it must be related to first blit mehod.
Title: Re: weird rendering artifact
Post by: EgonOlsen 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.
Title: Re: weird rendering artifact
Post by: raft 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.
Title: Re: weird rendering artifact
Post by: EgonOlsen on March 10, 2013, 10:21:43 pm
...still weird... ???
Title: Re: weird rendering artifact
Post by: raft on March 10, 2013, 10:25:25 pm
yup :-\

btw, seldomly I got an app crash, with the stacktrace below logged to file. maybe relevant?

Code: [Select]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
J  org.lwjgl.opengl.GL11.nglTexCoord2f(FFJ)V
J  com.threed.jpct.GLBase.blit([Ljava/lang/Object;FF)V
J  com.threed.jpct.GLRenderer.execute(I[Ljava/lang/Object;)V
J  com.threed.jpct.FrameBuffer.blit(Lcom/threed/jpct/Texture;IIIIIIIIIZLjava/awt/Color;)V
J  raft.glgui.opengl.TexturePack.blit(Lcom/threed/jpct/FrameBuffer;Lraft/glgui/opengl/TexturePack$Entry;IIIIIZLjava/awt/Color;)Ljava/awt/Dimension;
J  raft.glgui.opengl.TexturePack.blit(Lcom/threed/jpct/FrameBuffer;IIIIZLjava/awt/Color;)Ljava/awt/Dimension;
J  raft.glgui.opengl.GLFont.blitString(Lcom/threed/jpct/FrameBuffer;Ljava/lang/String;IIILcom/threed/jpct/RGBColor;)V
J  raft.jumpy.gl.JumpyTWL.render()V
Title: Re: weird rendering artifact
Post by: EgonOlsen on March 10, 2013, 10:34:31 pm
Maybe...but it doesn't make much sense except that it indicates some driver problem. The crashing command is something like

Code: [Select]
GL11.glTexCoord2f(<float>, <float>);

...and i don't see how this can crash anything under normal circumstances. Buffered blits don't do it that way, which might be the reason why they work...
Title: Re: weird rendering artifact
Post by: raft on March 10, 2013, 10:39:14 pm
mm, my best bet seems to be sticking to Config.glBufferedBlits=true.
Title: Re: weird rendering artifact
Post by: EgonOlsen on March 10, 2013, 10:41:05 pm
Yes. It's the only way that jPCT-AE knows anyway.