Sunday, May 08, 2005

Chris Campbell's Blog: STR-Crazy: Improving the OpenGL-based Java 2D Pipeline

Chris Campbell's Blog: STR-Crazy: Improving the OpenGL-based Java 2D Pipeline: "STR-Crazy: Improving the OpenGL-based Java 2D Pipeline
Posted by campbell on March 11, 2005 at 07:22 PM

One Thread To Rule Them All
As most developers are already aware, an OpenGL-based Java 2D pipeline (henceforth known as 'the OGL pipeline') was included in JDK 5.0 for improved rendering performance. While the OGL pipeline was a big step forward for rendering performance of complex operations (think transforms, compositing, gradients, etc), it was not nearly as robust as our existing X11- and DirectX-based pipelines. This meant that users evaluating their apps with the OGL pipeline enabled would see frequent crashes and rendering artifacts. Five steps forward, 3 steps back...

What was causing these crashes? If you're familiar with OpenGL, you probably know that it's important to do all your rendering from one (and only one) thread. While it is possible to render from other threads (if you're careful), OpenGL drivers are optimized for the single-threaded case. Games almost always play by these rules; they may use other threads for things like AI and physics calculations, but they do all their rendering from one display thread."

No comments: