darn jogl, darn it to heck...

im sorry to keep annoying everyone here with stupid questions. that said, here’s my newest one. :slight_smile:

transparent textures in my jogl program aren’t really “transparent” in the sense that objects behind them don’t show through: the transparent regions merely display the current background color. I assume this is due to the fact that I am not rendering polygons from back to front, but just “throwing them in.” So is there a “draw from back to front” method I can call? Or do I have to create some complicated mechanism of my own for this?

You have to sort the polygons yourself. There’s no way around this. I don’t have any real world experience with this myself, but I think bsp trees are still most commonly used for this (at least for static data).

The problem you are having is not a JOGL, or even OpenGL problem. It is a general 3D rendering issue. Here’s a blurb from my 3D engine chapter that will explain it better.

Render Order
It turns out that simply rendering in whatever order was in the scene list will probaby not work for most scenes. The reason is that transparent objects will probably not end up rendering correctly. Transparency is not automatically correct in modern 3D hardware but instead requires significant effort to be correctly implemented in a 3D engine.
Transparent objects need to be rendered with the proper OpenGL blending function after all other opaque objects are rendered before them to actually look transparent. Additional, within that transparent object render pass the transaprent objects must also be rendered farthest to nearest from the camera’s perspective. To be totally correct they have be rendered far to near on a face by face basis, and if any geometry intersecting, the intersecting faces would have to be split and sorted. Whew!

Totally correct scene transparency is often incredibly expensive to compute, especially for dynamic transparent geometry such as particle systems, so real-time 3D engines do the best they can by supporting depth sorted transparent objects, and rendering them after all the opaque objects.


Also if you are transforming your geoemtry, then you will be use that to get the objects “location” or z-depth for the sorting.

sigh… but I’m already getting 35 fps with only 7,000 polygons, I can’t afford any more “expensive” operations… where can I find a good tutorial on building [efficient] BSP trees?

Here is the faq:
http://www.faqs.org/faqs/graphics/bsptree-faq/

What type of geometry are you rendering. Do you need to sort the polygons. Most pepole just sort the objects.

Also consider if you can use addative blending. Then you don’t have to use sorting.