How to combine two rendered objects?

Hi,

I have two different programs, one to render a volume and another to draw something like a skeleton of it.
Now I need to show both together, basically the skeleton to be embedded in the volume. The obvious thing I tried was to first render the volume,
the witdh depth buffer disabled and blending enabled, I draw the skeleton. The problem I am having with this approach is that, what ever colour I
specify for the different parts of my skeleton, it shows up in black. Even when I tried this with gl.glBlendFunc(GL.GL_ONE, GL.GL_ZERO), I get the same result.
Is there any way I can retain the colour of the skeleton?

I know that the above problem is not with JOGL, but didn’t know where to post.

On another note, I seem to be getting the following error every time I quit a JOGL program that I run.


#
# An unexpected error has been detected by Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f6981835898, pid=8697, tid=1089038672
#
# Java VM: Java HotSpot(TM) 64-Bit Server VM (11.0-b15 mixed mode linux-amd64)
# Problematic frame:
# C  [libX11.so.6+0x37898]  XQueryExtension+0x28
#
# An error report file with more information is saved as:
# RGVolume/hs_err_pid8697.log
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
#


The worst part is it keeps generating those annoying error log, that my folder gets cluttered with them as i keep testing my application.
Also, I get this only for jogl programs. So is this a problem with JOGL or is it due to my java version?

Any help is appreciated, thanks.

When you say you’ve disabled the depth buffer for rendering the skeleton, do you mean you’ve disabled writing to the depth buffer, or disabled the depth test?

Can you reproduce the black color by blending in a simpler demo (such as two overlapping squares)?

Sorry, I meant depth test.

As for the second query, I couldn’t reproduce it with a simple demo. Anything I try with some simple code, it works just as I expect it to :frowning:
If it is of any help, for volume rendering, I use 3d textures, using fragment shader. and once that is finished, I use the
default shader program (using gl.glUseProgram(0) ) to render the skeleton. When I comment out the function call I make to render the volume,
the colours of the skeleton are being correctly rendered.

I’m not sure what’s going on, my intuition is that some state was set differently during the rendering of the volume that goofs up the skeleton. I’d make sure you’re disabling all the 3d textures and unbind them when you’re finished with the volume. There could be other things, such as lighting, that might also change how it’s being rendered, but it’s hard to guess.

Also, you could try rendering the skeleton first and then volume on top of that.

Thanks, I found out that I wasn’t disabling 3d textures. now it works fine.

Regarding the other error, Is it a problem with JOGL?

The problem is occurring in libX11.so which isn’t directly part of JOGL. My guess is JOGL is using X11 incorrectly or your X11 drivers have a bug in them. I’d try updating the drivers to see if that fixes anything, because generally jogl is pretty stable on linux.