Project

General

Profile

« Previous | Next » 

Revision a0f644b7

Added by Leszek Koltunski over 7 years ago

Again change of API. Now instead of the 'DistortedEffects.draw() and DistortedTree.draw()' we have 'DistortedFramebuffer.renderTo()'

View differences:

src/main/java/org/distorted/library/DistortedFramebuffer.java
245 245
    mMarked  = false;
246 246
    }
247 247

  
248
///////////////////////////////////////////////////////////////////////////////////////////////////
249
/**
250
 * Draw the (texture,grid,effects) object to the Framebuffer.
251
 * <p>
252
 * Must be called from a thread holding OpenGL Context
253
 *
254
 * @param tex input Texture to use.
255
 * @param grid Class descendant from GridObject
256
 * @param effects The DistortedEffects to use when rendering
257
 * @param time Current time, in milliseconds.
258
 */
259
  public void renderTo(DistortedTexture tex, GridObject grid, DistortedEffects effects, long time)
260
    {
261
    tex.createTexture();
262
    createFBO();
263
    GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, fboIds[0]);
264
    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, tex.mTextureDataH[0]);
265
    effects.drawPriv(time, tex, grid, this);
266
    DistortedFramebuffer.deleteAllMarked();
267
    DistortedTexture.deleteAllMarked();
268
    }
269

  
270
///////////////////////////////////////////////////////////////////////////////////////////////////
271
/**
272
 * Draws the Tree, and all its children, to the Framebuffer.
273
 * <p>
274
 * Must be called from a thread holding OpenGL Context
275
 *
276
 * @param dt DistortedTree to render.
277
 * @param time Current time, in milliseconds. This will be passed to all the Effects stored in the Tree.
278
 */
279
  public void renderTo(DistortedTree dt, long time)
280
    {
281
    createFBO();
282
    GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, fboIds[0]);
283
    dt.drawRecursive(time,this);
284
    DistortedFramebuffer.deleteAllMarked();
285
    DistortedTexture.deleteAllMarked();
286
    }
287

  
248 288
///////////////////////////////////////////////////////////////////////////////////////////////////
249 289
/**
250 290
 * Mark the underlying OpenGL object for deletion. Actual deletion will take place on the next render.

Also available in: Unified diff