Revision f8377ef8
Added by Leszek Koltunski about 7 years ago
src/main/java/org/distorted/library/DistortedFramebuffer.java | ||
---|---|---|
38 | 38 |
// Must be called from a thread holding OpenGL Context |
39 | 39 |
// Watch out - this has the side-effect of binding a Texture and a Framebuffer! |
40 | 40 |
|
41 |
public void create()
|
|
41 |
void create() |
|
42 | 42 |
{ |
43 | 43 |
if( mColorH[0]==NOT_CREATED_YET ) |
44 | 44 |
{ |
... | ... | |
71 | 71 |
|
72 | 72 |
checkStatus("depth"); |
73 | 73 |
} |
74 |
if( !mDepthEnabled && mDepthH[0]!=NOT_CREATED_YET ) // we need to detach and destroy the DEPTH attachment.
|
|
74 |
if( !mDepthEnabled && mDepthH[0]!=NOT_CREATED_YET ) // we need to detach and recreate the DEPTH attachment.
|
|
75 | 75 |
{ |
76 | 76 |
GLES30.glDeleteTextures(1, mDepthH, 0); |
77 | 77 |
mDepthH[0]=NOT_CREATED_YET; |
... | ... | |
125 | 125 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
126 | 126 |
// called from onDestroy(); mark OpenGL assets as 'not created' |
127 | 127 |
|
128 |
void destroy()
|
|
128 |
void recreate()
|
|
129 | 129 |
{ |
130 | 130 |
if( mColorH[0]!=DONT_CREATE ) mColorH[0] = NOT_CREATED_YET; |
131 | 131 |
if( mDepthEnabled ) mDepthH[0] = NOT_CREATED_YET; |
... | ... | |
231 | 231 |
|
232 | 232 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
233 | 233 |
/** |
234 |
* Create a new DEPTH buffer and attach it or (param=false) detach an existing DEPTh attachment and destroy it.
|
|
234 |
* Create a new DEPTH buffer and attach it or (param=false) detach an existing DEPTh attachment and recreate it.
|
|
235 | 235 |
* |
236 | 236 |
* @param enable <bold>true</bold> if we want to attach a new DEPTH buffer to the FBO.<br> |
237 | 237 |
* <bold>false</bold> if we want to detach the DEPTH attachment. |
238 | 238 |
*/ |
239 | 239 |
public void enableDepthAttachment(boolean enable) |
240 | 240 |
{ |
241 |
mDepthEnabled = enable; |
|
241 |
if( mDepthEnabled!=enable ) |
|
242 |
{ |
|
243 |
mDepthEnabled = enable; |
|
244 |
moveToToDo(); |
|
245 |
} |
|
242 | 246 |
} |
243 | 247 |
|
244 | 248 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
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.