Comments (4)
Possible solution for image update problem:
on GLG2DImageHelper:
void updateImage(Image image, int x, int y, int width, int height, Color bgColor, Buffer buffer);
on AbstractImageHelper:
public void updateImage(Image image, int x, int y, int width, int height, Color bgColor, Buffer buffer) {
Texture texture = cache.get(image);
if (texture != null) {
begin(texture, null, bgColor);
g2d.getGLContext().getGL().glTexSubImage2D(GL.GL_TEXTURE_2D, 0, 0, 0, image.getWidth(null), image.getHeight(null), GL.GL_RGBA, GL.GL_UNSIGNED_BYTE, buffer);
drawImage(image, x, y, width, height, bgColor, null);
end(texture);
}
}
The code is compatible with GL2 and ES2 (glTexSubImage2D),
I use for video update on textures..
from glg2d.
My custom WeakHashMap is a holdover from when I had some additional
functionality, I think I can expunge it.
There are two reasons I've stuck with clearing the cache on every paint.
- an Image may not have all its data at the time of painting in which
case we want to paint with new data the next time - an application may be painting custom Images then discarding them, in
which case we don't want to cache longer than we have to
But I do like your idea of using a RenderingHint to enable developers to
keep the cache from being cleared after each draw. Another option might be
a multi-level cache, where Images that do have all the data are kept across
draws and the cache has some maximum size.
from glg2d.
Is a big problem a new texture generation for every video frame :(
from glg2d.
I fixed this with 831147a. The new default cache policy is to never clear the cache. You can control this with the new GLG2DRenderingHints class. So if you draw the same icon each frame, it won't generate a new texture each time.
from glg2d.
Related Issues (20)
- Writing to image HOT 3
- NEWT Integration HOT 17
- use of pushMatrix and popMatrix HOT 6
- 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.