Skip to main content

Java now using OpenGL for 2D rendering

5 replies [Last post]
mswanson
Offline
Joined: 2006-02-17
Points: 0

Amazing news: according to bug 4498974 Sun has provided a way to use OpenGL
for image rendering. I'm wondering if they are also using it for:

1. image scaling
2. OpenGL would remove the need for all clipping code, I wonder if the
clipping codepaths are bypassed.
3. certain Graphics2D-based operations

Thoughts?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
campbell
Offline
Joined: 2003-06-24
Points: 0

[Hi Mark, I'll give you the same reply I provided over at javagaming.org, just for consistency ]

Hey guys, I was hoping that RFE evaluation would brighten your day a bit! The new OGL pipeline is pretty solid at this point, although there's still work to be done to avoid rendering inconsistencies across various driver implementations. I think many of you will be pleasantly surprised by the performance improvements...

My favorite testcase animates 4 images in a cycle, fading from one to another, rotating and scaling the images on the fly, using bilinear filtering, in a multibuffered window. In other words, all the good stuff that typically slows down an app big time. (Some of you may have seen this at JavaOne this year.) With our existing X11/software pipeline, we maybe get 2 fps with 100% CPU usage. With our new OGL pipeline, we get > 100 fps with virtually zero CPU usage.

To answer your questions, Mark:
1) Yep, image scaling can be accelerated via OpenGL.

2) Maybe I'm not following your question, but Swing apps still have to clip if necessary (Swing usually handles most clipping issues for you). But the good news is that both rectangular and complex (Shape) clips are handled at hardware speeds with OGL pipeline, which can really help speed up certain apps that do a lot of clipping to the Swing backbuffer or to the screen.

3) A very large percentage of rendering that goes through a Graphics2D object to an accelerated surface (say, the Swing backbuffer or the screen) will be accelerated in hardware by OpenGL. Lines, fills, text (cached in texture memory), images (cached in texture memory) can all be accelerated. Operations such as transforming, compositing, and clipping are also accelerated in hardware.

Let me know if there are any more questions, I know people have been waiting a long time for this stuff!

Chris

mswanson
Offline
Joined: 2006-02-17
Points: 0

Whoa..... outstanding. No, OUTSTANDING! After previewing, I just had to add that I'm blown away by this.

What about deployment? In a nutshell, will an unsigned Java Web Start application be able to benefit? (fingers crossed)

BTW, wrt #2: There was some talk on some of the X dev lists about removing all of the clipping code in XFree86 and re-implementing Window objects with OGL textures and using the zbuffer to perform the clipping in hardware. It was just an off-the-cuff question about doing the same thing in Swing and it isn't too important. You covered the important stuff.

(and thanks for posting here too)

campbell
Offline
Joined: 2003-06-24
Points: 0

> Whoa..... outstanding. No, OUTSTANDING! After
> previewing, I just had to add that I'm blown away by
> this.
>

Cool!

> What about deployment? In a nutshell, will an
> unsigned Java Web Start application be able to
> benefit? (fingers crossed)
>

Sure, this has no affect on deployment. If you have an unsigned app that works with JWS today, then it should work just fine if the OGL pipeline is enabled.

Note that we will only enable the OGL pipeline if it makes sense for that configuration. For example, if your installed OGL libraries are software only (such as Mesa) or do not meet certain minimum requirements in performance/quality, then we will just fall back to the existing X11 based pipeline.

Chris

mswanson
Offline
Joined: 2006-02-17
Points: 0

If the 2D->OGL pipeline works with unsigned JWS apps, then what about 3D->OGL?
I'm curious, is the 2D->OGL pipeline based on JOGL?

Thanks.

campbell
Offline
Joined: 2003-06-24
Points: 0

> If the 2D->OGL pipeline works with unsigned JWS apps,
> then what about 3D->OGL?
> I'm curious, is the 2D->OGL pipeline based on JOGL?
>

No, Java 2D is not implemented on top of JOGL. I think your question is based on the fact that JOGL is a third-party package, which contains native code. So from what I understand, you're required to sign your code when using JOGL with JWS. Since Java 2D is part of the JDK, you don't have such a restriction.

Chris