Revision 52358355
Added by Leszek Koltunski over 7 years ago
src/main/java/org/distorted/library/DistortedFramebuffer.java | ||
---|---|---|
262 | 262 |
createFBO(); |
263 | 263 |
GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, fboIds[0]); |
264 | 264 |
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, tex.mTextureDataH[0]); |
265 |
effects.drawPriv(time, tex, grid, this);
|
|
265 |
effects.drawPriv(tex.mHalfX, tex.mHalfY, grid, this, time);
|
|
266 | 266 |
DistortedFramebuffer.deleteAllMarked(); |
267 | 267 |
DistortedTexture.deleteAllMarked(); |
268 | 268 |
} |
269 | 269 |
|
270 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
271 |
/** |
|
272 |
* Draw the (framebuffer,grid,effects) object to the Framebuffer. |
|
273 |
* <p> |
|
274 |
* Must be called from a thread holding OpenGL Context |
|
275 |
* |
|
276 |
* @param fbo The Framebuffer whose COLOR attachment 0 will be used as input texture. |
|
277 |
* @param grid Class descendant from GridObject |
|
278 |
* @param effects The DistortedEffects to use when rendering |
|
279 |
* @param time Current time, in milliseconds. |
|
280 |
*/ |
|
281 |
public void renderTo(DistortedFramebuffer fbo, GridObject grid, DistortedEffects effects, long time) |
|
282 |
{ |
|
283 |
fbo.createFBO(); |
|
284 |
|
|
285 |
if( fbo.texIds[0]>=0 ) // we cannot (yet?) render to FBO created with the second constructor. |
|
286 |
{ |
|
287 |
createFBO(); |
|
288 |
GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, fboIds[0]); |
|
289 |
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, fbo.texIds[0]); |
|
290 |
effects.drawPriv(fbo.mWidth/2, fbo.mHeight/2, grid, this, time); |
|
291 |
DistortedFramebuffer.deleteAllMarked(); |
|
292 |
DistortedTexture.deleteAllMarked(); |
|
293 |
} |
|
294 |
} |
|
295 |
|
|
270 | 296 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
271 | 297 |
/** |
272 | 298 |
* Draws the Tree, and all its children, to the Framebuffer. |
Also available in: Unified diff
Add API to render from a FBO to another FBO