Re: [TextRenderer] Using depth test in 2D mode
Posted by Demoscene Passivist on Dec 15, 2010; 11:58am
URL: https://forum.jogamp.org/TextRenderer-Using-depth-test-in-2D-mode-tp2084831p2091552.html
>I tried to enable depth-test in beginRendering() but result is the same.
Sure, the result is the same. Its as I stated before u have to use draw3D to give ur text a Z position. Otherwise all text rendering is handled on the same z plane resulting in the observed "overlay-ish" behavior.
>and I need depth-test to be done between spheres and texts.
>Anyone knows if it's possible with 2d mode of TextRenderer ?
I guess u misunderstand the 2D/3D mode of TextRenderer. Actually the 2D "draw(CharSequence str, int x, int y)" rendering is using "draw3D(str, x, y, 0, 1);" internally. The only difference is that 2D draw() is setting the Z coordinate of the text billboard always to 0.
So theres no real "2D mode" of TextRenderer. U can safely intermix 2D/3D text rendering methods. To get what u want u have to do the following:
setup ur normal 3d matrix stuff
draw n spheres with radius r at x,y,z
beginRendering(screenwidth, screenheight, false)
z = (individual sphere z) + r + (some fixed offset_bias)
draw3D(str, x, y, z, 1)
endRendering()
Hope that pseudo code helped a little bit to clear things up ...