Project

General

Profile

« Previous | Next » 

Revision c41d046c

Added by Leszek Koltunski over 6 years ago

Make sure we don't create a feedback loop in oitRender

View differences:

src/main/java/org/distorted/library/main/DistortedFramebuffer.java
65 65
      GLES31.glTexParameteri(GLES31.GL_TEXTURE_2D, GLES31.GL_TEXTURE_WRAP_T, GLES31.GL_REPEAT);
66 66
      GLES31.glTexParameteri(GLES31.GL_TEXTURE_2D, GLES31.GL_TEXTURE_MIN_FILTER, GLES31.GL_NEAREST);
67 67
      GLES31.glTexParameteri(GLES31.GL_TEXTURE_2D, GLES31.GL_TEXTURE_MAG_FILTER, GLES31.GL_NEAREST);
68
      GLES31.glTexParameteri(GLES31.GL_TEXTURE_2D, GLES31.GL_DEPTH_STENCIL_TEXTURE_MODE, GLES31.GL_DEPTH_COMPONENT);
68 69

  
69 70
      if( mDepthStencil==DEPTH_NO_STENCIL )
70 71
        {
src/main/java/org/distorted/library/main/DistortedOutputSurface.java
356 356

  
357 357
    DistortedRenderState.enableStencil();
358 358

  
359
    // we cannot compare DEPTH24_STENCIL8 format to DEPTH32 which oitRender's fragment shader expects.
359
    // we have to unbind DEPTH buffer lest we create a feedback loop
360 360

  
361 361
    if( mDepthStencil==BOTH_DEPTH_STENCIL )
362 362
      {
363
      GLES31.glBindFramebuffer(GLES31.GL_FRAMEBUFFER, mFBOH[0]);
364 363
      GLES31.glFramebufferTexture2D(GLES31.GL_FRAMEBUFFER, GLES31.GL_DEPTH_STENCIL_ATTACHMENT, GLES31.GL_TEXTURE_2D, 0, 0);
365
      GLES31.glTexParameteri(GLES31.GL_TEXTURE_2D, GLES31.GL_DEPTH_STENCIL_TEXTURE_MODE, GLES31.GL_DEPTH_COMPONENT);
364
      }
365
    else if( mDepthStencil==DEPTH_NO_STENCIL )
366
      {
367
      GLES31.glFramebufferTexture2D(GLES31.GL_FRAMEBUFFER, GLES31.GL_DEPTH_ATTACHMENT        , GLES31.GL_TEXTURE_2D, 0, 0);
366 368
      }
367 369

  
368 370
    DistortedEffects.oitRender(this, buffer.getWidthCorrection(), buffer.getHeightCorrection() );
369 371

  
370 372
    if( mDepthStencil==BOTH_DEPTH_STENCIL )
371 373
      {
372
      GLES31.glBindFramebuffer(GLES31.GL_FRAMEBUFFER, mFBOH[0]);
373 374
      GLES31.glFramebufferTexture2D(GLES31.GL_FRAMEBUFFER, GLES31.GL_DEPTH_STENCIL_ATTACHMENT, GLES31.GL_TEXTURE_2D, mDepthStencilH[0], 0);
374 375
      }
376
    else if( mDepthStencil==DEPTH_NO_STENCIL )
377
      {
378
      GLES31.glFramebufferTexture2D(GLES31.GL_FRAMEBUFFER, GLES31.GL_DEPTH_ATTACHMENT        , GLES31.GL_TEXTURE_2D, mDepthStencilH[0], 0);
379
      }
375 380

  
376 381
    GLES31.glActiveTexture(GLES31.GL_TEXTURE1);
377 382
    GLES31.glBindTexture(GLES31.GL_TEXTURE_2D, 0);

Also available in: Unified diff