Main repository of MikuMikuStudio
Revision | b698ece235f9dfec82d7a82383259eacb8d1007a (tree) |
---|---|
Zeit | 2013-05-16 09:53:58 |
Autor | shadowisLORD <shadowisLORD@75d0...> |
Commiter | shadowisLORD |
git-svn-id: http://jmonkeyengine.googlecode.com/svn/trunk@10618 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
@@ -296,7 +296,7 @@ public class AndroidOpenALSoftAudioRenderer implements AndroidAudioRenderer, Run | ||
296 | 296 | id = ib.get(0); |
297 | 297 | f.setId(id); |
298 | 298 | |
299 | - objManager.registerForCleanup(f); | |
299 | + objManager.registerObject(f); | |
300 | 300 | } |
301 | 301 | |
302 | 302 | if (f instanceof LowPassFilter) { |
@@ -1212,7 +1212,7 @@ public class AndroidOpenALSoftAudioRenderer implements AndroidAudioRenderer, Run | ||
1212 | 1212 | id = ib.get(0); |
1213 | 1213 | ab.setId(id); |
1214 | 1214 | |
1215 | - objManager.registerForCleanup(ab); | |
1215 | + objManager.registerObject(ab); | |
1216 | 1216 | } |
1217 | 1217 | |
1218 | 1218 | ab.getData().clear(); |
@@ -942,7 +942,7 @@ public class OGLESShaderRenderer implements Renderer { | ||
942 | 942 | shader.clearUpdateNeeded(); |
943 | 943 | if (needRegister) { |
944 | 944 | // Register shader for clean up if it was created in this method. |
945 | - objManager.registerForCleanup(shader); | |
945 | + objManager.registerObject(shader); | |
946 | 946 | statistics.onNewShader(); |
947 | 947 | } else { |
948 | 948 | // OpenGL spec: uniform locations may change after re-link |
@@ -1318,7 +1318,7 @@ public class OGLESShaderRenderer implements Renderer { | ||
1318 | 1318 | |
1319 | 1319 | id = intBuf1.get(0); |
1320 | 1320 | fb.setId(id); |
1321 | - objManager.registerForCleanup(fb); | |
1321 | + objManager.registerObject(fb); | |
1322 | 1322 | |
1323 | 1323 | statistics.onNewFrameBuffer(); |
1324 | 1324 | } |
@@ -1673,7 +1673,7 @@ public class OGLESShaderRenderer implements Renderer { | ||
1673 | 1673 | |
1674 | 1674 | texId = intBuf1.get(0); |
1675 | 1675 | img.setId(texId); |
1676 | - objManager.registerForCleanup(img); | |
1676 | + objManager.registerObject(img); | |
1677 | 1677 | |
1678 | 1678 | statistics.onNewTexture(); |
1679 | 1679 | } |
@@ -1880,7 +1880,7 @@ public class OGLESShaderRenderer implements Renderer { | ||
1880 | 1880 | |
1881 | 1881 | bufId = intBuf1.get(0); |
1882 | 1882 | vb.setId(bufId); |
1883 | - objManager.registerForCleanup(vb); | |
1883 | + objManager.registerObject(vb); | |
1884 | 1884 | |
1885 | 1885 | created = true; |
1886 | 1886 | } |
@@ -2252,14 +2252,9 @@ public class OGLESShaderRenderer implements Renderer { | ||
2252 | 2252 | |
2253 | 2253 | /** |
2254 | 2254 | * renderMeshVertexArray renders a mesh using vertex arrays |
2255 | - * @param mesh | |
2256 | - * @param lod | |
2257 | - * @param count | |
2258 | 2255 | */ |
2259 | 2256 | private void renderMeshVertexArray(Mesh mesh, int lod, int count) { |
2260 | - // IntMap<VertexBuffer> buffers = mesh.getBuffers(); | |
2261 | - for (VertexBuffer vb : mesh.getBufferList().getArray()){ | |
2262 | - | |
2257 | + for (VertexBuffer vb : mesh.getBufferList().getArray()) { | |
2263 | 2258 | if (vb.getBufferType() == Type.InterleavedData |
2264 | 2259 | || vb.getUsage() == Usage.CpuOnly // ignore cpu-only buffers |
2265 | 2260 | || vb.getBufferType() == Type.Index) { |
@@ -2306,7 +2301,6 @@ public class OGLESShaderRenderer implements Renderer { | ||
2306 | 2301 | indices = mesh.getBuffer(Type.Index);// buffers.get(Type.Index.ordinal()); |
2307 | 2302 | } |
2308 | 2303 | for (VertexBuffer vb : mesh.getBufferList().getArray()){ |
2309 | - | |
2310 | 2304 | if (vb.getBufferType() == Type.InterleavedData |
2311 | 2305 | || vb.getUsage() == Usage.CpuOnly // ignore cpu-only buffers |
2312 | 2306 | || vb.getBufferType() == Type.Index) { |
@@ -46,6 +46,11 @@ public abstract class NativeObject implements Cloneable { | ||
46 | 46 | public static final int INVALID_ID = -1; |
47 | 47 | |
48 | 48 | /** |
49 | + * The object manager to which this NativeObject is registered to. | |
50 | + */ | |
51 | + protected NativeObjectManager objectManager = null; | |
52 | + | |
53 | + /** | |
49 | 54 | * The ID of the object, usually depends on its type. |
50 | 55 | * Typically returned from calls like glGenTextures, glGenBuffers, etc. |
51 | 56 | */ |
@@ -82,9 +87,14 @@ public abstract class NativeObject implements Cloneable { | ||
82 | 87 | this.id = id; |
83 | 88 | } |
84 | 89 | |
90 | + void setNativeObjectManager(NativeObjectManager objectManager) { | |
91 | + this.objectManager = objectManager; | |
92 | + } | |
93 | + | |
85 | 94 | /** |
86 | - * Sets the ID of the GLObject. This method is used in Renderer and must | |
95 | + * Sets the ID of the NativeObject. This method is used in Renderer and must | |
87 | 96 | * not be called by the user. |
97 | + * | |
88 | 98 | * @param id The ID to set |
89 | 99 | */ |
90 | 100 | public void setId(int id){ |
@@ -138,6 +148,7 @@ public abstract class NativeObject implements Cloneable { | ||
138 | 148 | try { |
139 | 149 | NativeObject obj = (NativeObject) super.clone(); |
140 | 150 | obj.handleRef = new Object(); |
151 | + obj.objectManager = null; | |
141 | 152 | obj.id = INVALID_ID; |
142 | 153 | obj.updateNeeded = true; |
143 | 154 | return obj; |
@@ -187,4 +198,17 @@ public abstract class NativeObject implements Cloneable { | ||
187 | 198 | * should be functional for this object. |
188 | 199 | */ |
189 | 200 | public abstract NativeObject createDestructableClone(); |
201 | + | |
202 | + /** | |
203 | + * Reclaims native resources used by this NativeObject. | |
204 | + * It should be safe to call this method or even use the object | |
205 | + * after it has been reclaimed, unless {@link NativeObjectManager#UNSAFE} is | |
206 | + * set to true, in that case native buffers are also reclaimed which may | |
207 | + * introduce instability. | |
208 | + */ | |
209 | + public void dispose() { | |
210 | + if (objectManager != null) { | |
211 | + objectManager.markUnusedObject(this); | |
212 | + } | |
213 | + } | |
190 | 214 | } |
@@ -31,11 +31,13 @@ | ||
31 | 31 | */ |
32 | 32 | package com.jme3.util; |
33 | 33 | |
34 | -import com.jme3.scene.VertexBuffer; | |
34 | +import com.jme3.renderer.Renderer; | |
35 | 35 | import java.lang.ref.PhantomReference; |
36 | 36 | import java.lang.ref.ReferenceQueue; |
37 | 37 | import java.lang.ref.WeakReference; |
38 | -import java.util.HashSet; | |
38 | +import java.util.ArrayDeque; | |
39 | +import java.util.ArrayList; | |
40 | +import java.util.Queue; | |
39 | 41 | import java.util.logging.Level; |
40 | 42 | import java.util.logging.Logger; |
41 | 43 |
@@ -50,7 +52,14 @@ import java.util.logging.Logger; | ||
50 | 52 | public class NativeObjectManager { |
51 | 53 | |
52 | 54 | private static final Logger logger = Logger.getLogger(NativeObjectManager.class.getName()); |
53 | - | |
55 | + | |
56 | + /** | |
57 | + * Set to <code>true</code> to enable deletion of native buffers together with GL objects | |
58 | + * when requested. Note that usage of object after deletion could cause undefined results | |
59 | + * or native crashes, therefore by default this is set to <code>false</code>. | |
60 | + */ | |
61 | + public static boolean UNSAFE = false; | |
62 | + | |
54 | 63 | /** |
55 | 64 | * The maximum number of objects that should be removed per frame. |
56 | 65 | * If the limit is reached, no more objects will be removed for that frame. |
@@ -58,23 +67,26 @@ public class NativeObjectManager { | ||
58 | 67 | private static final int MAX_REMOVES_PER_FRAME = 100; |
59 | 68 | |
60 | 69 | /** |
61 | - * The queue will receive notifications of {@link NativeObject}s which | |
62 | - * are no longer referenced. | |
70 | + * Reference queue for {@link NativeObjectRef native object references}. | |
63 | 71 | */ |
64 | 72 | private ReferenceQueue<Object> refQueue = new ReferenceQueue<Object>(); |
65 | 73 | |
66 | 74 | /** |
67 | 75 | * List of currently active GLObjects. |
68 | 76 | */ |
69 | - private HashSet<NativeObjectRef> refList | |
70 | - = new HashSet<NativeObjectRef>(); | |
77 | + private IntMap<NativeObjectRef> refMap = new IntMap<NativeObjectRef>(); | |
78 | + | |
79 | + /** | |
80 | + * List of real objects requested by user for deletion. | |
81 | + */ | |
82 | + private ArrayDeque<NativeObject> userDeletionQueue = new ArrayDeque<NativeObject>(); | |
71 | 83 | |
72 | - private class NativeObjectRef extends PhantomReference<Object>{ | |
84 | + private static class NativeObjectRef extends PhantomReference<Object> { | |
73 | 85 | |
74 | 86 | private NativeObject objClone; |
75 | 87 | private WeakReference<NativeObject> realObj; |
76 | 88 | |
77 | - public NativeObjectRef(NativeObject obj){ | |
89 | + public NativeObjectRef(ReferenceQueue<Object> refQueue, NativeObject obj){ | |
78 | 90 | super(obj.handleRef, refQueue); |
79 | 91 | assert obj.handleRef != null; |
80 | 92 |
@@ -84,18 +96,68 @@ public class NativeObjectManager { | ||
84 | 96 | } |
85 | 97 | |
86 | 98 | /** |
87 | - * Register a GLObject with the manager. | |
99 | + * (Internal use only) Register a <code>NativeObject</code> with the manager. | |
88 | 100 | */ |
89 | - public void registerForCleanup(NativeObject obj){ | |
90 | - NativeObjectRef ref = new NativeObjectRef(obj); | |
91 | - refList.add(ref); | |
101 | + public void registerObject(NativeObject obj) { | |
102 | + if (obj.getId() <= 0) { | |
103 | + throw new IllegalArgumentException("object id must be greater than zero"); | |
104 | + } | |
105 | + | |
106 | + NativeObjectRef ref = new NativeObjectRef(refQueue, obj); | |
107 | + refMap.put(obj.getId(), ref); | |
108 | + | |
109 | + obj.setNativeObjectManager(this); | |
110 | + | |
92 | 111 | if (logger.isLoggable(Level.FINEST)) { |
93 | 112 | logger.log(Level.FINEST, "Registered: {0}", new String[]{obj.toString()}); |
94 | 113 | } |
95 | 114 | } |
115 | + | |
116 | + private void deleteNativeObject(Object rendererObject, NativeObject obj, NativeObjectRef ref, | |
117 | + boolean deleteGL, boolean deleteBufs) { | |
118 | + assert rendererObject != null; | |
119 | + | |
120 | + // "obj" is considered the real object (with buffers and everything else) | |
121 | + // if "ref" is null. | |
122 | + NativeObject realObj = ref != null ? | |
123 | + ref.realObj.get() : | |
124 | + obj; | |
125 | + | |
126 | + assert realObj == null || obj.getId() == realObj.getId(); | |
127 | + | |
128 | + if (deleteGL && obj.getId() > 0) { | |
129 | + // Unregister it from cleanup list. | |
130 | + NativeObjectRef ref2 = refMap.remove(obj.getId()); | |
131 | + if (ref2 == null) { | |
132 | + throw new IllegalArgumentException("This NativeObject is not " + | |
133 | + "registered in this NativeObjectManager"); | |
134 | + } | |
96 | 135 | |
136 | + assert ref == null || ref == ref2; | |
137 | + | |
138 | + // Delete object from the GL driver | |
139 | + obj.deleteObject(rendererObject); | |
140 | + assert obj.getId() == NativeObject.INVALID_ID; | |
141 | + | |
142 | + if (logger.isLoggable(Level.FINEST)) { | |
143 | + logger.log(Level.FINEST, "Deleted: {0}", obj); | |
144 | + } | |
145 | + | |
146 | + if (realObj != null){ | |
147 | + // Note: make sure to reset them as well | |
148 | + // They may get used in a new renderer in the future | |
149 | + realObj.resetObject(); | |
150 | + } | |
151 | + } | |
152 | + if (deleteBufs && UNSAFE && realObj != null) { | |
153 | + // Only the real object has native buffers. | |
154 | + // The destructable clone has nothing and cannot be used in this case. | |
155 | + realObj.deleteNativeBuffersInternal(); | |
156 | + } | |
157 | + } | |
158 | + | |
97 | 159 | /** |
98 | - * Deletes unused NativeObjects. | |
160 | + * (Internal use only) Deletes unused NativeObjects. | |
99 | 161 | * Will delete at most {@link #MAX_REMOVES_PER_FRAME} objects. |
100 | 162 | * |
101 | 163 | * @param rendererObject The renderer object. |
@@ -103,14 +165,20 @@ public class NativeObjectManager { | ||
103 | 165 | */ |
104 | 166 | public void deleteUnused(Object rendererObject){ |
105 | 167 | int removed = 0; |
168 | + while (removed < MAX_REMOVES_PER_FRAME && !userDeletionQueue.isEmpty()) { | |
169 | + // Remove user requested objects. | |
170 | + NativeObject obj = userDeletionQueue.pop(); | |
171 | + deleteNativeObject(rendererObject, obj, null, true, true); | |
172 | + removed++; | |
173 | + } | |
106 | 174 | while (removed < MAX_REMOVES_PER_FRAME) { |
175 | + // Remove objects reclaimed by GC. | |
107 | 176 | NativeObjectRef ref = (NativeObjectRef) refQueue.poll(); |
108 | 177 | if (ref == null) { |
109 | 178 | break; |
110 | 179 | } |
111 | 180 | |
112 | - refList.remove(ref); | |
113 | - ref.objClone.deleteObject(rendererObject); | |
181 | + deleteNativeObject(rendererObject, ref.objClone, ref, true, false); | |
114 | 182 | removed++; |
115 | 183 | } |
116 | 184 | if (removed >= 1) { |
@@ -119,38 +187,49 @@ public class NativeObjectManager { | ||
119 | 187 | } |
120 | 188 | |
121 | 189 | /** |
122 | - * Deletes all objects. Must only be called when display is destroyed. | |
190 | + * (Internal use only) Deletes all objects. | |
191 | + * Must only be called when display is destroyed. | |
123 | 192 | */ |
124 | 193 | public void deleteAllObjects(Object rendererObject){ |
125 | 194 | deleteUnused(rendererObject); |
126 | - for (NativeObjectRef ref : refList){ | |
127 | - ref.objClone.deleteObject(rendererObject); | |
128 | - NativeObject realObj = ref.realObj.get(); | |
129 | - if (realObj != null){ | |
130 | - // Note: make sure to reset them as well | |
131 | - // They may get used in a new renderer in the future | |
132 | - realObj.resetObject(); | |
133 | - } | |
195 | + for (IntMap.Entry<NativeObjectRef> entry : refMap) { | |
196 | + NativeObjectRef ref = entry.getValue(); | |
197 | + deleteNativeObject(rendererObject, ref.objClone, ref, true, false); | |
134 | 198 | } |
135 | - refList.clear(); | |
199 | + assert refMap.size() == 0; | |
136 | 200 | } |
137 | 201 | |
138 | 202 | /** |
139 | - * Resets all {@link NativeObject}s. | |
203 | + * Marks the given <code>NativeObject</code> as unused, | |
204 | + * to be deleted on the next frame. | |
205 | + * Usage of this object after deletion will cause an exception. | |
206 | + * Note that native buffers are only reclaimed if | |
207 | + * {@link #UNSAFE} is set to <code>true</code>. | |
208 | + * | |
209 | + * @param obj The object to mark as unused. | |
210 | + */ | |
211 | + void enqueueUnusedObject(NativeObject obj) { | |
212 | + userDeletionQueue.push(obj); | |
213 | + } | |
214 | + | |
215 | + /** | |
216 | + * (Internal use only) Resets all {@link NativeObject}s. | |
217 | + * This is typically called when the context is restarted. | |
140 | 218 | */ |
141 | 219 | public void resetObjects(){ |
142 | - for (NativeObjectRef ref : refList){ | |
143 | - // here we use the actual obj not the clone, | |
144 | - // otherwise its useless | |
145 | - NativeObject realObj = ref.realObj.get(); | |
146 | - if (realObj == null) | |
220 | + for (IntMap.Entry<NativeObjectRef> entry : refMap) { | |
221 | + // Must use the real object here, for this to be effective. | |
222 | + NativeObject realObj = entry.getValue().realObj.get(); | |
223 | + if (realObj == null) { | |
147 | 224 | continue; |
225 | + } | |
148 | 226 | |
149 | 227 | realObj.resetObject(); |
150 | - if (logger.isLoggable(Level.FINEST)) | |
228 | + if (logger.isLoggable(Level.FINEST)) { | |
151 | 229 | logger.log(Level.FINEST, "Reset: {0}", realObj); |
230 | + } | |
152 | 231 | } |
153 | - refList.clear(); | |
232 | + refMap.clear(); | |
154 | 233 | } |
155 | 234 | |
156 | 235 | // public void printObjects(){ |
@@ -294,7 +294,7 @@ public class JoalAudioRenderer implements AudioRenderer, Runnable { | ||
294 | 294 | id = ib.get(0); |
295 | 295 | f.setId(id); |
296 | 296 | |
297 | - objManager.registerForCleanup(f); | |
297 | + objManager.registerObject(f); | |
298 | 298 | } |
299 | 299 | |
300 | 300 | if (f instanceof LowPassFilter) { |
@@ -1033,7 +1033,7 @@ public class JoalAudioRenderer implements AudioRenderer, Runnable { | ||
1033 | 1033 | id = ib.get(0); |
1034 | 1034 | ab.setId(id); |
1035 | 1035 | |
1036 | - objManager.registerForCleanup(ab); | |
1036 | + objManager.registerObject(ab); | |
1037 | 1037 | } |
1038 | 1038 | |
1039 | 1039 | ab.getData().clear(); |
@@ -782,7 +782,7 @@ public class JoglGL1Renderer implements GL1Renderer { | ||
782 | 782 | gl.glGenTextures(1, ib1); |
783 | 783 | texId = ib1.get(0); |
784 | 784 | img.setId(texId); |
785 | - objManager.registerForCleanup(img); | |
785 | + objManager.registerObject(img); | |
786 | 786 | |
787 | 787 | statistics.onNewTexture(); |
788 | 788 | } |
@@ -1143,7 +1143,7 @@ public class JoglRenderer implements Renderer { | ||
1143 | 1143 | shader.clearUpdateNeeded(); |
1144 | 1144 | if (needRegister) { |
1145 | 1145 | // Register shader for clean up if it was created in this method. |
1146 | - objManager.registerForCleanup(shader); | |
1146 | + objManager.registerObject(shader); | |
1147 | 1147 | statistics.onNewShader(); |
1148 | 1148 | } else { |
1149 | 1149 | // OpenGL spec: uniform locations may change after re-link |
@@ -1506,7 +1506,7 @@ public class JoglRenderer implements Renderer { | ||
1506 | 1506 | gl.glGenFramebuffers(1, intBuf1); |
1507 | 1507 | id = intBuf1.get(0); |
1508 | 1508 | fb.setId(id); |
1509 | - objManager.registerForCleanup(fb); | |
1509 | + objManager.registerObject(fb); | |
1510 | 1510 | |
1511 | 1511 | statistics.onNewFrameBuffer(); |
1512 | 1512 | } |
@@ -1899,7 +1899,7 @@ public class JoglRenderer implements Renderer { | ||
1899 | 1899 | gl.glGenTextures(1, intBuf1); |
1900 | 1900 | texId = intBuf1.get(0); |
1901 | 1901 | img.setId(texId); |
1902 | - objManager.registerForCleanup(img); | |
1902 | + objManager.registerObject(img); | |
1903 | 1903 | |
1904 | 1904 | statistics.onNewTexture(); |
1905 | 1905 | } |
@@ -2141,7 +2141,7 @@ public class JoglRenderer implements Renderer { | ||
2141 | 2141 | gl.glGenBuffers(1, intBuf1); |
2142 | 2142 | bufId = intBuf1.get(0); |
2143 | 2143 | vb.setId(bufId); |
2144 | - objManager.registerForCleanup(vb); | |
2144 | + objManager.registerObject(vb); | |
2145 | 2145 | |
2146 | 2146 | //statistics.onNewVertexBuffer(); |
2147 | 2147 |
@@ -266,7 +266,7 @@ public class LwjglAudioRenderer implements AudioRenderer, Runnable { | ||
266 | 266 | id = ib.get(0); |
267 | 267 | f.setId(id); |
268 | 268 | |
269 | - objManager.registerForCleanup(f); | |
269 | + objManager.registerObject(f); | |
270 | 270 | } |
271 | 271 | |
272 | 272 | if (f instanceof LowPassFilter) { |
@@ -1002,7 +1002,7 @@ public class LwjglAudioRenderer implements AudioRenderer, Runnable { | ||
1002 | 1002 | id = ib.get(0); |
1003 | 1003 | ab.setId(id); |
1004 | 1004 | |
1005 | - objManager.registerForCleanup(ab); | |
1005 | + objManager.registerObject(ab); | |
1006 | 1006 | } |
1007 | 1007 | |
1008 | 1008 | ab.getData().clear(); |
@@ -729,7 +729,7 @@ public class LwjglGL1Renderer implements GL1Renderer { | ||
729 | 729 | glGenTextures(ib1); |
730 | 730 | texId = ib1.get(0); |
731 | 731 | img.setId(texId); |
732 | - objManager.registerForCleanup(img); | |
732 | + objManager.registerObject(img); | |
733 | 733 | |
734 | 734 | statistics.onNewTexture(); |
735 | 735 | } |
@@ -55,6 +55,7 @@ import com.jme3.texture.Texture; | ||
55 | 55 | import com.jme3.texture.Texture.WrapAxis; |
56 | 56 | import com.jme3.util.BufferUtils; |
57 | 57 | import com.jme3.util.ListMap; |
58 | +import com.jme3.util.NativeObject; | |
58 | 59 | import com.jme3.util.NativeObjectManager; |
59 | 60 | import com.jme3.util.SafeArrayList; |
60 | 61 | import java.nio.*; |
@@ -129,10 +130,12 @@ public class LwjglRenderer implements Renderer { | ||
129 | 130 | nameBuf.rewind(); |
130 | 131 | } |
131 | 132 | |
133 | + @Override | |
132 | 134 | public Statistics getStatistics() { |
133 | 135 | return statistics; |
134 | 136 | } |
135 | 137 | |
138 | + @Override | |
136 | 139 | public EnumSet<Caps> getCaps() { |
137 | 140 | return caps; |
138 | 141 | } |
@@ -1081,7 +1084,7 @@ public class LwjglRenderer implements Renderer { | ||
1081 | 1084 | shader.clearUpdateNeeded(); |
1082 | 1085 | if (needRegister) { |
1083 | 1086 | // Register shader for clean up if it was created in this method. |
1084 | - objManager.registerForCleanup(shader); | |
1087 | + objManager.registerObject(shader); | |
1085 | 1088 | statistics.onNewShader(); |
1086 | 1089 | } else { |
1087 | 1090 | // OpenGL spec: uniform locations may change after re-link |
@@ -1431,7 +1434,7 @@ public class LwjglRenderer implements Renderer { | ||
1431 | 1434 | glGenFramebuffersEXT(intBuf1); |
1432 | 1435 | id = intBuf1.get(0); |
1433 | 1436 | fb.setId(id); |
1434 | - objManager.registerForCleanup(fb); | |
1437 | + objManager.registerObject(fb); | |
1435 | 1438 | |
1436 | 1439 | statistics.onNewFrameBuffer(); |
1437 | 1440 | } |
@@ -1802,7 +1805,7 @@ public class LwjglRenderer implements Renderer { | ||
1802 | 1805 | glGenTextures(intBuf1); |
1803 | 1806 | texId = intBuf1.get(0); |
1804 | 1807 | img.setId(texId); |
1805 | - objManager.registerForCleanup(img); | |
1808 | + objManager.registerObject(img); | |
1806 | 1809 | |
1807 | 1810 | statistics.onNewTexture(); |
1808 | 1811 | } |
@@ -2041,7 +2044,7 @@ public class LwjglRenderer implements Renderer { | ||
2041 | 2044 | glGenBuffers(intBuf1); |
2042 | 2045 | bufId = intBuf1.get(0); |
2043 | 2046 | vb.setId(bufId); |
2044 | - objManager.registerForCleanup(vb); | |
2047 | + objManager.registerObject(vb); | |
2045 | 2048 | |
2046 | 2049 | //statistics.onNewVertexBuffer(); |
2047 | 2050 |