fix for bug #150, now queues opengl images to be deleted

This commit is contained in:
benfry
2007-06-11 19:57:12 +00:00
parent 0606e2ef32
commit de528342af
3 changed files with 44 additions and 12 deletions
+16 -3
View File
@@ -71,6 +71,22 @@ X http://dev.processing.org/bugs/show_bug.cgi?id=564
X added min() and max() for float and int arrays
_ need to update reference
X moved around min/max functions
X opengl image memory leaking
X when creating a new PImage on every frame, slurps a ton of memory
X workaround is to write the code properly, but suggests something bad
X http://dev.processing.org/bugs/show_bug.cgi?id=150
new bugs (organize later)
_ opengl crashes when depth sorting more than two textured shapes
_ http://dev.processing.org/bugs/show_bug.cgi?id=560
_ replaceAll() not supported by 1.1
_ http://dev.processing.org/bugs/show_bug.cgi?id=561
ewjordan stuff
_ Polygons parallel to z-axis not always filling with nonzero x or y
_ http://dev.processing.org/bugs/show_bug.cgi?id=547
_ strange texture warping in P3D
_ http://dev.processing.org/bugs/show_bug.cgi?id=103
_ loadBytes() doesn't do auto gunzip? but loadStrings and createReader do?
_ this might be a good solution for dealing with the differences
@@ -897,9 +913,6 @@ _ otherwise can crash the whole browser
_ get rid of some of the sillier IntBuffer stuff where it's not needed
_ use the version of the prototypes that use an offset into the array
_ need to test performance either way
_ when creating a new PImage on every frame, slurps a ton of memory
_ workaround is to write the code properly, but suggests something bad
_ http://dev.processing.org/bugs/show_bug.cgi?id=150
_ make a note about the anti-aliasing types in the faq
_ polygon vs line etc.. may want to enable lines but disable polys
_ invocationtargetexception in gl with aioobe:
@@ -810,29 +810,37 @@ public class PGraphicsOpenGL extends PGraphics3D {
static int maxTextureSize;
int[] deleteQueue = new int[10];
int deleteQueueCount = 0;
class ImageCache {
int tindex = -1; // not yet ready
int tpixels[];
IntBuffer tbuffer;
int twidth, theight;
/*
public ImageCache(PImage image) {
tindex = -1; // mark the texture as uninited
prepare(image);
int[] tp;
// first-time binding of entire texture
gl.glEnable(GL.GL_TEXTURE_2D);
gl.glDisable(GL.GL_TEXTURE_2D);
protected void finalize() {
if (deleteQueue.length == deleteQueueCount) {
deleteQueue = (int[]) PApplet.expand(deleteQueue);
}
if (tindex != -1) {
deleteQueue[deleteQueueCount++] = tindex;
}
}
*/
/**
* Generate a texture ID and do the necessary bitshifting for the image.
*/
public void rebind(PImage source) {
if (deleteQueueCount != 0) {
//gl.glDeleteTextures(1, new int[] { tindex }, 0);
gl.glDeleteTextures(deleteQueueCount, deleteQueue, 0);
deleteQueueCount = 0;
}
//System.out.println("rebinding texture for " + source);
if (tindex != -1) {
// free up the old memory
@@ -842,6 +850,7 @@ public class PGraphicsOpenGL extends PGraphics3D {
int[] tmp = new int[1];
gl.glGenTextures(1, tmp, 0);
tindex = tmp[0];
//System.out.println("got index " + tindex);
// bit shifting this might be more efficient
int width2 = nextPowerOfTwo(source.width);
+10
View File
@@ -42,6 +42,16 @@ X http://dev.processing.org/bugs/show_bug.cgi?id=357
X ignore ._ files when reading jar and zip
X Ignoring /Users/fry/coconut/processing/build/macosx/work/libraries/opengl/library/._jogl-natives-linux-i586.jar (error in opening zip file)
new bugs
_ huge jar files from 0124 export
_ http://dev.processing.org/bugs/show_bug.cgi?id=541
_ if someone has monaco disabled in font book, the app won't start
_ http://dev.processing.org/bugs/show_bug.cgi?id=562
0126
_ do the big move to multiple sketches open
_ finish up debian package support (see the processing.mess folder)
_ xml element needs to be readable from other charsets
_ same with the other methods like loadStrings()