Project

General

Profile

« Previous | Next » 

Revision 61ce8e90

Added by Leszek Koltunski almost 6 years ago

Minor.

View differences:

src/main/java/org/distorted/library/main/DistortedOutputSurface.java
325 325
    return 1;
326 326
    }
327 327

  
328
///////////////////////////////////////////////////////////////////////////////////////////////////
329

  
330
  private static void clearBuffer(DistortedOutputSurface buffer, int fbo)
331
    {
332
    GLES31.glStencilMask(0xff);
333
    GLES31.glDepthMask(true);
334
    GLES31.glColorMask(true,true,true,true);
335
    GLES31.glClearColor(1.0f,1.0f,1.0f,0.0f);
336
    GLES31.glClearDepthf(1.0f);
337
    GLES31.glClearStencil(0);
338

  
339
    buffer.setAsOutputFBO(fbo);
340
    GLES31.glFramebufferTexture2D(GLES31.GL_FRAMEBUFFER, GLES31.GL_COLOR_ATTACHMENT0, GLES31.GL_TEXTURE_2D, buffer.mColorH[2*fbo+1], 0);
341
    GLES31.glClear(GLES31.GL_COLOR_BUFFER_BIT|GLES31.GL_DEPTH_BUFFER_BIT|GLES31.GL_STENCIL_BUFFER_BIT);
342
    GLES31.glFramebufferTexture2D(GLES31.GL_FRAMEBUFFER, GLES31.GL_COLOR_ATTACHMENT0, GLES31.GL_TEXTURE_2D, buffer.mColorH[2*fbo  ], 0);
343
    GLES31.glClear(GLES31.GL_COLOR_BUFFER_BIT);
344
    }
345

  
346 328
///////////////////////////////////////////////////////////////////////////////////////////////////
347 329

  
348 330
  void clear()
......
401 383
            numRenders += lastQueue.postprocess(mBuffer,fbo);
402 384
            numRenders += oitBuild(time,mBuffer[quality],fbo);
403 385
            GLES31.glMemoryBarrier(GLES31.GL_SHADER_STORAGE_BARRIER_BIT|GLES31.GL_ATOMIC_COUNTER_BARRIER_BIT);
404
            clearBuffer(mBuffer[quality],fbo);
386
            mBuffer[quality].clearBuffer(fbo);
405 387
            }
406 388

  
407 389
          internalQuality = currQueue.getInternalQuality();
......
425 407
          numRenders += oitBuild(time,mBuffer[quality],fbo);
426 408
          GLES31.glMemoryBarrier(GLES31.GL_SHADER_STORAGE_BARRIER_BIT|GLES31.GL_ATOMIC_COUNTER_BARRIER_BIT);
427 409
          numRenders += oitRender(time,fbo);  // merge the OIT linked list
428
          clearBuffer(mBuffer[quality],fbo);
410
          mBuffer[quality].clearBuffer(fbo);
429 411
          }
430 412
        } // end else (postprocessed child)
431 413

  
......
465 447
    return (float)mHeight/mRealHeight;
466 448
    }
467 449

  
450
///////////////////////////////////////////////////////////////////////////////////////////////////
451

  
452
  private void clearBuffer(int fbo)
453
    {
454
    GLES31.glStencilMask(0xff);
455
    GLES31.glDepthMask(true);
456
    GLES31.glColorMask(true,true,true,true);
457
    GLES31.glClearColor(1.0f,1.0f,1.0f,0.0f);
458
    GLES31.glClearDepthf(1.0f);
459
    GLES31.glClearStencil(0);
460

  
461
    GLES31.glBindFramebuffer(GLES31.GL_FRAMEBUFFER, mFBOH[fbo]);
462
    GLES31.glFramebufferTexture2D(GLES31.GL_FRAMEBUFFER, GLES31.GL_COLOR_ATTACHMENT0, GLES31.GL_TEXTURE_2D, mColorH[2*fbo+1], 0);
463
    GLES31.glClear(GLES31.GL_COLOR_BUFFER_BIT|GLES31.GL_DEPTH_BUFFER_BIT|GLES31.GL_STENCIL_BUFFER_BIT);
464
    GLES31.glFramebufferTexture2D(GLES31.GL_FRAMEBUFFER, GLES31.GL_COLOR_ATTACHMENT0, GLES31.GL_TEXTURE_2D, mColorH[2*fbo  ], 0);
465
    GLES31.glClear(GLES31.GL_COLOR_BUFFER_BIT);
466
    }
467

  
468 468
///////////////////////////////////////////////////////////////////////////////////////////////////
469 469

  
470 470
  private void setAsOutputFBO(long time, int fbo)
......
730 730
      mNear=0.99f;
731 731
      }
732 732

  
733
    if( mBuffer!=null )
734
      {
735
      for(int j=0; j<EffectQuality.LENGTH; j++) mBuffer[j].mNear = mNear;
736
      }
737

  
733 738
    createProjection();
734 739
    }
735 740

  

Also available in: Unified diff