www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: Dinin on November 17, 2013, 11:50:52 am

Title: Z-Buffer Problems
Post by: Dinin 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]
Title: Re: Z-Buffer Problems
Post by: EgonOlsen on November 17, 2013, 12:30:42 pm
Which device/GPU are you using?
Title: Re: Z-Buffer Problems
Post by: Dinin 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 ?!?
Title: Re: Z-Buffer Problems
Post by: EgonOlsen 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).
Title: Re: Z-Buffer Problems
Post by: Dinin 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 ?
Title: Re: Z-Buffer Problems
Post by: EgonOlsen on November 17, 2013, 03:38:57 pm
Try to do

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

instead.
Title: Re: Z-Buffer Problems
Post by: Dinin on November 17, 2013, 03:42:33 pm
 ::) sometimes i'm so blind .... thanks