Revision f8377ef8
Added by Leszek Koltunski about 7 years ago
src/main/java/org/distorted/library/DistortedNode.java | ||
---|---|---|
58 | 58 |
numPointingNodes= 1; |
59 | 59 |
numRendered = 0; |
60 | 60 |
mFBO = null; |
61 |
|
|
62 |
android.util.Log.e("DistortedNode", "new NodeData"); |
|
61 | 63 |
} |
62 | 64 |
} |
63 | 65 |
|
... | ... | |
125 | 127 |
if( newList.size()>1 ) |
126 | 128 |
{ |
127 | 129 |
if( mData.mFBO ==null ) |
130 |
{ |
|
131 |
android.util.Log.e("DistortedNode", "creating a new FBO"); |
|
132 |
|
|
128 | 133 |
mData.mFBO = new DistortedFramebuffer(mSurface.getWidth(), mSurface.getHeight()); |
134 |
} |
|
129 | 135 |
} |
130 | 136 |
else |
131 | 137 |
{ |
132 | 138 |
if( mData.mFBO !=null ) |
133 | 139 |
{ |
140 |
android.util.Log.e("DistortedNode", "marking FBO for deletion and setting it to NULL"); |
|
141 |
|
|
134 | 142 |
mData.mFBO.markForDeletion(); |
135 | 143 |
mData.mFBO = null; |
136 | 144 |
} |
... | ... | |
200 | 208 |
|
201 | 209 |
void drawRecursive(long currTime, DistortedOutputSurface surface) |
202 | 210 |
{ |
203 |
mSurface.create(); |
|
204 | 211 |
float halfX = mSurface.getWidth()/2.0f; |
205 | 212 |
float halfY = mSurface.getHeight()/2.0f; |
206 | 213 |
|
... | ... | |
210 | 217 |
} |
211 | 218 |
else |
212 | 219 |
{ |
213 |
mData.mFBO.create(); |
|
214 |
|
|
215 | 220 |
if( mData.numRendered==0 ) |
216 | 221 |
{ |
217 | 222 |
mData.mFBO.setAsOutput(); |
... | ... | |
345 | 350 |
ArrayList<Long> prev = generateIDList(); |
346 | 351 |
|
347 | 352 |
if( mChildren==null ) mChildren = new ArrayList<>(2); |
348 |
|
|
353 |
|
|
354 |
android.util.Log.e("DistortedNode", "ATTACH1"); |
|
355 |
|
|
356 |
|
|
349 | 357 |
node.mParent = this; |
350 | 358 |
mChildren.add(node); |
351 | 359 |
mNumChildren[0]++; |
... | ... | |
365 | 373 |
public synchronized DistortedNode attach(DistortedInputSurface surface, DistortedEffects effects, MeshObject mesh) |
366 | 374 |
{ |
367 | 375 |
ArrayList<Long> prev = generateIDList(); |
368 |
|
|
376 |
|
|
377 |
android.util.Log.e("DistortedNode", "ATTACH2"); |
|
378 |
|
|
369 | 379 |
if( mChildren==null ) mChildren = new ArrayList<>(2); |
370 | 380 |
DistortedNode node = new DistortedNode(surface,effects,mesh); |
371 | 381 |
node.mParent = this; |
... | ... | |
392 | 402 |
|
393 | 403 |
if( mChildren.remove(node) ) |
394 | 404 |
{ |
395 |
node.mParent = null; |
|
405 |
android.util.Log.e("DistortedNode", "DETACH1"); |
|
406 |
|
|
407 |
node.mParent = null; |
|
396 | 408 |
mNumChildren[0]--; |
397 | 409 |
|
398 | 410 |
RecomputeNodeID(prev); |
... | ... | |
425 | 437 |
|
426 | 438 |
if( node.mEffects.getID()==id ) |
427 | 439 |
{ |
440 |
android.util.Log.e("DistortedNode", "DETACH2"); |
|
441 |
|
|
442 |
|
|
428 | 443 |
ArrayList<Long> prev = generateIDList(); |
429 | 444 |
|
430 | 445 |
node.mParent = null; |
Also available in: Unified diff
New, cleaner way to create/destroy DistortedSurfaces.
Serious regression in StarWars (crashes!). Looks like the Node's internal FBO is being deleted and not re-created in time.