Author Topic: Z-Buffer Problems  (Read 915 times)

Offline Dinin

  • byte
  • *
  • Posts: 28
    • View Profile
Z-Buffer Problems
« on: November 17, 2013, 11:50:52 am »
Hi !

I have a body wearing a armor. When the camera is near, everything is fine. But if i move the camera out, the armor does not render correct. It seems to be partially behind the body.  :-[

I attached 2 screenshots showing the problem.

Setting transparency to -1 has no effect.

Any suggestions ?

Thanks and greetings
Dinin

[attachment deleted by admin]

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Z-Buffer Problems
« Reply #1 on: November 17, 2013, 12:30:42 pm »
Which device/GPU are you using?

Offline Dinin

  • byte
  • *
  • Posts: 28
    • View Profile
Re: Z-Buffer Problems
« Reply #2 on: November 17, 2013, 12:47:47 pm »
I'm using HTC One with GPU Adreno 320.

I've now tested it on a Galaxy S2 and there everything works fine ?!?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Z-Buffer Problems
« Reply #3 on: November 17, 2013, 01:00:32 pm »
Adreno seems to be only chip that really uses a 16bit zbuffer if nothing else has been requested. You can work around this by using the NVDepthConfigChooser in jPCT-AE's util package, but you have to use OpenGL ES 2.0 for this to work (in case you aren't already).

Offline Dinin

  • byte
  • *
  • Posts: 28
    • View Profile
Re: Z-Buffer Problems
« Reply #4 on: November 17, 2013, 03:33:55 pm »
Yes, i,ve done:
Code: [Select]
NVDepthConfigChooser nvDepthConfigChooser = new NVDepthConfigChooser(this);
EGL10 egl = (EGL10) EGLContext.getEGL();
EGLDisplay glDisplay = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);

egl.eglInitialize(glDisplay, new int[]{2,0});
eglConfig = nvDepthConfigChooser.chooseConfig(egl, glDisplay);

EGLConfigChooser myEGLConfigChooser = new EGLConfigChooser() {

@Override
public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display) {
return eglConfig;
}
};
setEGLConfigChooser(myEGLConfigChooser);
Now it renders correct even on HTC One.
Many Thanks !

But now i'm not able to get a transparent background. Buffer.Clear with transparent color and setZOrderOnTop(true) do not work.
Do you have any idea what else i can do to get transparent background ?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Z-Buffer Problems
« Reply #5 on: November 17, 2013, 03:38:57 pm »
Try to do

Code: [Select]
new NVDepthConfigChooser(this, true);

instead.

Offline Dinin

  • byte
  • *
  • Posts: 28
    • View Profile
Re: Z-Buffer Problems
« Reply #6 on: November 17, 2013, 03:42:33 pm »
 ::) sometimes i'm so blind .... thanks