Z-Buffer Problems

Started by Dinin, November 17, 2013, 11:50:52 AM

Previous topic - Next topic

Dinin

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]

EgonOlsen

Which device/GPU are you using?

Dinin

I'm using HTC One with GPU Adreno 320.

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

EgonOlsen

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).

Dinin

Yes, i,ve done:
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 ?

EgonOlsen

Try to do


new NVDepthConfigChooser(this, true);


instead.

Dinin

 ::) sometimes i'm so blind .... thanks