Giter VIP home page Giter VIP logo

Comments (3)

brandonborkholder avatar brandonborkholder commented on August 27, 2024

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.

it-open avatar it-open commented on August 27, 2024

I have two parts.

  1. 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)
  2. 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.

brandonborkholder avatar brandonborkholder commented on August 27, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.