Project

General

Profile

« Previous | Next » 

Revision 5f7e4f2c

Added by Leszek Koltunski almost 6 years ago

Hide the FBO_QUEUE thing inside the library. The queue is running internally now, without public setAsOutputFBO() thing (simplifies writing postprocess effects)

View differences:

src/main/java/org/distorted/library/main/DistortedFramebuffer.java
254 254
/**
255 255
 * Bind the underlying rectangle of pixels as a OpenGL Texture.
256 256
 *
257
 * @param texture The Texture number to bind (and thus read from).
257 258
 * @return <code>true</code> if successful.
258 259
 */
259 260
  public boolean setAsInput(int texture)
260 261
    {
261
    if( texture>=0 && texture<mNumFBOs*mNumColors && mColorH[texture]>0 )
262
    if( texture>=0 && texture<mNumColors && mColorH[texture]>0 )
262 263
      {
263 264
      GLES31.glActiveTexture(GLES31.GL_TEXTURE0);
264
      GLES31.glBindTexture(GLES31.GL_TEXTURE_2D, mColorH[texture]);
265
      GLES31.glBindTexture(GLES31.GL_TEXTURE_2D, mColorH[2*mCurrFBO+texture]);
265 266
      return true;
266 267
      }
267 268

  
......
269 270
    }
270 271

  
271 272
///////////////////////////////////////////////////////////////////////////////////////////////////
272

  
273
  /**
274
   * Attach the texture'th Texture to COLOR0 attachment.
275
   *
276
   * @param texture The Texture number to attach (and subsequently use to render to)
277
   */
273 278
  public void bindForOutput(int texture)
274 279
    {
275
    if( texture>=0 && texture<mNumFBOs*mNumColors && mColorH[texture]>0 )
280
    if( texture>=0 && texture<mNumColors && mColorH[texture]>0 )
276 281
      {
277
      GLES31.glFramebufferTexture2D(GLES31.GL_FRAMEBUFFER, GLES31.GL_COLOR_ATTACHMENT0, GLES31.GL_TEXTURE_2D, mColorH[texture], 0);
282
      GLES31.glFramebufferTexture2D(GLES31.GL_FRAMEBUFFER, GLES31.GL_COLOR_ATTACHMENT0, GLES31.GL_TEXTURE_2D, mColorH[2*mCurrFBO+texture], 0);
278 283
      }
279 284
    }
280 285

  

Also available in: Unified diff