Comments (3)
This library is intended to speed up general Swing drawing when you're
displaying it to the user. Drawing into an offscreen buffer, like a
texture will be just as fast, but getting that texture back off the video
card won't be. Swing will keep everything on the CPU. glg2d will draw it
to the video card and then if you want a BufferedImage, you need to read it
back and video cards are not optimized to operate like that.
How long does it take you to draw a complex scene to a BufferedImage using
Java2D currently?
from glg2d.
I have two parts.
- I have an Application based on java.awt.Window. On this window I draw the Image of my gui. Every Component of the gui draws an Image. And every Container (like Panel) draws the Components according to their z-order (g.drawimage). When a Component/Panel does not change it will not be redrawn. On the Window only the region which has been changed will be redrawn on the Screen. I use Window because in J7 you can draw a transparent Image/Color on the Window and the Application will be transparent. Every Image also uses RGBA.
The Initial Draw of all Compopnents can last up to 300ms for the whole Screen. But goes down on changes to 10ms.
This is mainly because the fillrect or worse fillroundrect uses a lot of time.
The Image will be drawn Offscreen and every Component keeps it Image and the whole Scene is the displayed on the Screen. I tried with pure OpenGl but the OpenGlCanvas cannot be transparent. (Corrent me if I'm wrong) - I make video Editing. I get a Image from a Video and use this as Base. Then according to some calculations I make diffent Overlays (Transparent Logos, and other Infos). The I save the Image back to a other Stream. More Speed is better but it does not depend on the speed here because the Video Decoding/Encoding takes most of the Time. (I can use normal java Graphics here)
from glg2d.
I finally got around to writing a test that will help you see how to use GLG2D to draw Swing into an OpenGL image or FBO. Here is an example that explains all the steps you need to take https://github.com/brandonborkholder/glg2d/blob/master/src/test/java/org/jogamp/glg2d/examples/FBOExample.java and here is a more useful example of how I applied GLG2D to draw a Swing component into an image and then read the image back again https://github.com/brandonborkholder/glg2d/blob/master/src/test/java/org/jogamp/glg2d/ImageTest.java.
I also think you might want to take a look at Newt for your application. It allows much better control over your windows (transparent windows, undecorated windows, etc). You can still use glg2d to draw Swing into Newt, see https://github.com/brandonborkholder/glg2d/blob/master/src/test/java/org/jogamp/glg2d/examples/NewtExample.java
from glg2d.
Related Issues (20)
- NEWT Integration HOT 17
- use of pushMatrix and popMatrix HOT 6
- Image cache cleaning HOT 4
- NullPointerException in AbstractColorHelper HOT 3
- Checksum does not match HOT 7
- Problem in the Texture cache of the AbstractImageHelper class HOT 3
- Abstract OpenGL layer to allow for JOGL or LWJGL backends HOT 8
- GLG2DCanvas renders only once HOT 1
- Aparapi BufferedImage GPU Image support? HOT 3
- Full-Screen Exclusive Mode API - Black Screen HOT 1
- Mouse Events in UIDemo HOT 4
- Using it with BufferedImage HOT 2
- Re: How to create the latest version of GLG2D jar file HOT 2
- Re: JPopMenu is not triggered & displayed on GLG2DCanvas component HOT 1
- 0.5 snapshot
- Rendering Images Makes glg2d unhappy
- Does not render for transparent backgrounds
- Deploy uberjar with jogl inside it HOT 2
- Examples: WARNING: Drawable component and children should be pure Swing: javax.swing.CellRendererPane[,0,0,0x0,invalid,hidden] does not inherit JComponent
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from glg2d.