/[gzz]/gzz/gzz/gfx/gl/GL.java
ViewVC logotype

Diff of /gzz/gzz/gfx/gl/GL.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.22 by tjl, Sat Nov 23 19:03:35 2002 UTC revision 1.23 by tjl, Tue Dec 3 19:14:12 2002 UTC
# Line 23  GL.java Line 23  GL.java
23  package gzz.gfx.gl;  package gzz.gfx.gl;
24  import java.awt.Rectangle;  import java.awt.Rectangle;
25  import java.awt.Dimension;  import java.awt.Dimension;
26    import java.util.ArrayList;
27    import java.util.Iterator;
28  import java.util.Set;  import java.util.Set;
29  import java.util.HashSet;  import java.util.HashSet;
30  import java.util.StringTokenizer;  import java.util.StringTokenizer;
# Line 106  public class GL { Line 108  public class GL {
108       */       */
109      public static final int RENDERABLE3 = 0x3000000;      public static final int RENDERABLE3 = 0x3000000;
110    
111        static ArrayList queue = new ArrayList();
112    
113        /** Because objects have to be released by the same thread
114         * that obtained them, this method needs to be called every
115         * once in a while.
116         */
117        static public void freeQueue() {
118            synchronized(queue) {
119                for(Iterator i = queue.iterator(); i.hasNext(); ) {
120                    JavaObject obj = ((JavaObject)i.next());
121                    obj.deleteObj();
122                    obj.id = 0;
123                }
124                queue.clear();
125            }
126        }
127    
128      /** The Java proxy for a C++ object.      /** The Java proxy for a C++ object.
129       */       */
130      static public abstract class JavaObject extends gzz.vob.Vob {      static public abstract class JavaObject extends gzz.vob.Vob {
# Line 115  public class GL { Line 134  public class GL {
134           */           */
135          public void finalize() {          public void finalize() {
136              if(this.dbg) pa("Finalizing "+this+" "+id);              if(this.dbg) pa("Finalizing "+this+" "+id);
137              if(id != 0) throw new Error("Zero id object!");              // Would like to
138              deleteObj();              //          deleteObj();
139              id = 0;              // but can't due to thread problems.
140                if(id != 0)
141                    synchronized(queue) {
142                        queue.add(this);
143                    }
144          }          }
145          public void render(java.awt.Graphics g,          public void render(java.awt.Graphics g,
146                              boolean fast,                              boolean fast,
# Line 651  public class GL { Line 674  public class GL {
674      static public class ByteVector extends NonRenderableJavaObject {      static public class ByteVector extends NonRenderableJavaObject {
675          private ByteVector(int id) {          private ByteVector(int id) {
676              super(id);              super(id);
677                if(dbg) pa("Create bytevector\n");
678            }
679            protected void deleteObj() {
680                if(dbg) pa("Delete bytevector\n");
681                deleteByteVector(getId());
682          }          }
         protected void deleteObj() { deleteByteVector(getId()); }  
683    
684          /** Get a value from this byte vector.          /** Get a value from this byte vector.
685           * @param ind The index of the value to get.           * @param ind The index of the value to get.

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.23

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26