Revision d1e740c5
Added by Leszek Koltunski about 8 years ago
src/main/java/org/distorted/library/DistortedFramebuffer.java | ||
---|---|---|
194 | 194 |
} |
195 | 195 |
} |
196 | 196 |
|
197 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
198 |
// Set this as the Framebuffer to write to. |
|
199 |
|
|
200 |
void setAsOutput() |
|
201 |
{ |
|
202 |
if( texIds[0]==TEXTURE_NOT_CREATED_YET ) createFBO(); |
|
203 |
|
|
204 |
GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, fboIds[0]); |
|
205 |
} |
|
206 |
|
|
207 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
208 |
// Set this as the Framebuffer to read from. |
|
209 |
|
|
210 |
void setAsInput() |
|
211 |
{ |
|
212 |
if( texIds[0]==TEXTURE_NOT_CREATED_YET ) createFBO(); |
|
213 |
|
|
214 |
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texIds[0]); |
|
215 |
} |
|
216 |
|
|
217 | 197 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
218 | 198 |
// PUBLIC API |
219 | 199 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
313 | 293 |
if( texIds[0]>0 ) markForDeletion(); |
314 | 294 |
} |
315 | 295 |
} |
296 |
|
|
297 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
298 |
/** |
|
299 |
* Set this as the Framebuffer to write to. |
|
300 |
*/ |
|
301 |
public void setAsOutput() |
|
302 |
{ |
|
303 |
if( texIds[0]==TEXTURE_NOT_CREATED_YET ) createFBO(); |
|
304 |
|
|
305 |
GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, fboIds[0]); |
|
306 |
} |
|
307 |
|
|
308 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
309 |
/** |
|
310 |
* Set this as the Framebuffer to read from. |
|
311 |
*/ |
|
312 |
public void setAsInput() |
|
313 |
{ |
|
314 |
if( texIds[0]==TEXTURE_NOT_CREATED_YET ) createFBO(); |
|
315 |
|
|
316 |
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texIds[0]); |
|
317 |
} |
|
318 |
|
|
316 | 319 |
} |
src/main/java/org/distorted/library/DistortedNode.java | ||
---|---|---|
456 | 456 |
*/ |
457 | 457 |
public void draw(long currTime) |
458 | 458 |
{ |
459 |
GLES20.glActiveTexture(GLES20.GL_TEXTURE0); |
|
460 | 459 |
GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0); |
461 | 460 |
|
462 | 461 |
markRecursive(); |
463 | 462 |
drawRecursive(currTime,Distorted.mFramebuffer); |
464 | 463 |
} |
465 |
|
|
464 |
|
|
465 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
466 |
/** |
|
467 |
* Draws the Node, and all its children, to the Framebuffer passed. |
|
468 |
* |
|
469 |
* @param currTime Current time, in milliseconds. |
|
470 |
* @param df Framebuffer to render this to. |
|
471 |
*/ |
|
472 |
public void draw(long currTime, DistortedFramebuffer df) |
|
473 |
{ |
|
474 |
df.setAsOutput(); |
|
475 |
markRecursive(); |
|
476 |
drawRecursive(currTime,df); |
|
477 |
} |
|
478 |
|
|
466 | 479 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
467 | 480 |
/** |
468 | 481 |
* Returns the DistortedObject object that's in the Node. |
src/main/java/org/distorted/library/DistortedObject.java | ||
---|---|---|
320 | 320 |
/** |
321 | 321 |
* Draw the DistortedObject to the location specified by current Matrix effects. |
322 | 322 |
* |
323 |
* @param currTime current time, in milliseconds, as returned by System.currentTimeMillis().
|
|
323 |
* @param currTime current time, in milliseconds. |
|
324 | 324 |
* This gets passed on to Dynamics inside the Effects that are currently applied to the |
325 | 325 |
* Object. |
326 | 326 |
*/ |
327 | 327 |
public void draw(long currTime) |
328 | 328 |
{ |
329 | 329 |
GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0); |
330 |
|
|
331 | 330 |
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTextureDataH[0]); |
332 |
|
|
333 | 331 |
drawPriv(currTime, Distorted.mFramebuffer); |
334 | 332 |
} |
335 |
|
|
333 |
|
|
334 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
335 |
/** |
|
336 |
* Draw the DistortedObject to the Framebuffer passed. |
|
337 |
* |
|
338 |
* @param currTime Current time, in milliseconds. |
|
339 |
* @param df Framebuffer to render this to. |
|
340 |
*/ |
|
341 |
public void draw(long currTime, DistortedFramebuffer df) |
|
342 |
{ |
|
343 |
df.setAsOutput(); |
|
344 |
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTextureDataH[0]); |
|
345 |
drawPriv(currTime,df); |
|
346 |
} |
|
347 |
|
|
336 | 348 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
337 | 349 |
/** |
338 | 350 |
* Releases all resources. |
... | ... | |
545 | 557 |
/** |
546 | 558 |
* Scales the Object by (possibly changing in time) 3D scale factors. |
547 | 559 |
* |
548 |
* @param scale 3-dimensional Dynamic which at any given time returns a Static3D
|
|
560 |
* @param scale 3-dimensional Data which at any given time returns a Static3D
|
|
549 | 561 |
* representing the current x- , y- and z- scale factors. |
550 | 562 |
* @return ID of the effect added, or -1 if we failed to add one. |
551 | 563 |
*/ |
Also available in: Unified diff
Move the 'Save' app to using a DistortedFramebuffer.