David Yazel wrote:
> Ok I think this an depth test problem. The alpha is showing through the
> terrain if it is folded as if the depth check is disabled.
>
> It should be :
>
> glEnable( GL_DEPTH_TEST );
>
> glDepthFunc( GL_LEQUAL );
>
>
>
> Is this how decals are implemented?
>
>
Decals is implement using stencil buffer
as follows:
---------------------------------------------
// First Decal children D1
// Normally depth buffer is enable before
if (glIsEnabled(GL_DEPTH_TEST)) {
depthBufferEnable = JNI_TRUE)
}
glEnable(GL_STENCIL_TEST);
glStencilFunc (GL_ALWAYS, 0x1, 0x1);
glStencilOp (GL_KEEP, GL_KEEP, GL_REPLACE);
Render decal children D1
Recusively render children of D1
// Second Decal children D2
glDisable(GL_DEPTH_TEST);
glStencilFunc (GL_EQUAL, 0x1, 0x1);
glStencilOp (GL_KEEP, GL_KEEP, GL_KEEP);
Render decal children D2
Recusively render children of D2
Render decal children D3
Recusively render children of D3
....
// Last decal children Dn
Render decal children Dn
Recusively render children of Dn
glDisable(GL_STENCIL_TEST);
if (depthBufferEnable == JNI_TRUE) {
glEnable(GL_DEPTH_TEST);
}
---------------------------------------------------
I'm guessing the loop enter the first Decal children
the depth buffer is already disable so some reason
(may be it is explicitly set in RenderingAttributes).
Or
The transparency shape is under descending of
children D2, ... or Dn so depth test is disable.
Or
OpenGL fail to get a pixelFormat that support
stencil buffer. In this case the above algorithm
will not work. Try DirectX version to see what
happen.
Hope it helps to construct a test case that
demonstrate the problem.
Thanks.
- Kelvin
------------------
Java 3D Team
Sun Microsystems Inc.
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".