Project

General

Profile

« Previous | Next » 

Revision 23eecbd9

Added by Leszek Koltunski about 7 years ago

Progress with Stencil app. Rendering through an intermediate FBO still doesn't quite work.

View differences:

src/main/java/org/distorted/library/DistortedOutputSurface.java
30 30
/**
31 31
 * Do not create DEPTH or STENCIL attachment
32 32
 */
33
  public static final int NO_DEPTH_STENCIL = 0;
33
  public static final int NO_DEPTH_NO_STENCIL = 0;
34 34
/**
35 35
 * Create DEPTH, but not STENCIL
36 36
 */
37
  public static final int DEPTH_NO_STENCIL = 1;
37
  public static final int DEPTH_NO_STENCIL    = 1;
38 38
/**
39 39
 * Create both DEPTH and STENCIL
40 40
 */
41
  public static final int BOTH_DEPTH_STENCIL= 2;
41
  public static final int BOTH_DEPTH_STENCIL  = 2;
42 42

  
43 43
  private static final int ATTACH = 0;
44 44
  private static final int DETACH = 1;
......
78 78

  
79 79
  private float mClearR, mClearG, mClearB, mClearA;
80 80
  private float mClearDepth;
81
  private int mClearStencil;
81 82
  private int mClear;
82 83

  
83 84
//private String sNew="", sOld="";
......
95 96
    mFOV = 60.0f;
96 97
    mNear=  0.5f;
97 98

  
98
    mDepthStencilCreated= (depthStencil==NO_DEPTH_STENCIL ? DONT_CREATE:NOT_CREATED_YET);
99
    mDepthStencilCreated= (depthStencil== NO_DEPTH_NO_STENCIL ? DONT_CREATE:NOT_CREATED_YET);
99 100
    mDepthStencil = depthStencil;
100 101

  
101 102
    mFBOH[0]         = fbo;
......
109 110
    mClearA = 0.0f;
110 111

  
111 112
    mClearDepth = 1.0f;
113
    mClearStencil = 0;
112 114
    mClear = GLES30.GL_DEPTH_BUFFER_BIT | GLES30.GL_COLOR_BUFFER_BIT;
113 115

  
114 116
    mBuffer1 = new DistortedFramebuffer[EffectQuality.LENGTH];
......
196 198

  
197 199
          for(int j=0; j<EffectQuality.LENGTH; j++)
198 200
            {
199
            mBuffer1[j] = new DistortedFramebuffer( mDepthStencil   , DistortedObject.TYPE_SYST,
201
            mBuffer1[j] = new DistortedFramebuffer( mDepthStencil     , DistortedObject.TYPE_SYST,
200 202
                                                    (int)(mWidth*mipmap), (int)(mHeight*mipmap) );
201
            mBuffer2[j] = new DistortedFramebuffer( NO_DEPTH_STENCIL, DistortedObject.TYPE_SYST,
203
            mBuffer2[j] = new DistortedFramebuffer(NO_DEPTH_NO_STENCIL, DistortedObject.TYPE_SYST,
202 204
                                                    (int)(mWidth*mipmap), (int)(mHeight*mipmap) );
203 205
            mBuffer1[j].mMipmap = mipmap;
204 206
            mipmap *= EffectQuality.MULTIPLIER;
......
310 312
    if( mTime!=time )
311 313
      {
312 314
      mTime = time;
313
      DistortedRenderState.colorDepthOn();
315
      DistortedRenderState.colorDepthStencilOn();
314 316
      GLES30.glClearColor(mClearR, mClearG, mClearB, mClearA);
315 317
      GLES30.glClearDepthf(mClearDepth);
318
      GLES30.glClearStencil(mClearStencil);
316 319
      GLES30.glClear(mClear);
317 320
      }
318 321
    }
......
361 364

  
362 365
///////////////////////////////////////////////////////////////////////////////////////////////////
363 366
/**
364
 * Set the Depth value of GLES30.glClearDepthf() to set up depth with which to clear
365
 * the Depth buffer of Surface at the beginning of each frame.
367
 * Uses glClearDepthf() to set up a value with which to clear
368
 * the Depth buffer of our Surface at the beginning of each frame.
366 369
 *
367 370
 * @param d the Depth. Default: 1.0f
368 371
 */
......
371 374
    mClearDepth = d;
372 375
    }
373 376

  
377
///////////////////////////////////////////////////////////////////////////////////////////////////
378
/**
379
 * Uses glClearStencil() to set up a value with which to clear the
380
 * Stencil buffer of our Surface at the beginning of each frame.
381
 *
382
 * @param s the Stencil. Default: 0
383
 */
384
  public void glClearStencil(int s)
385
    {
386
    mClearStencil = s;
387
    }
388

  
374 389
///////////////////////////////////////////////////////////////////////////////////////////////////
375 390
/**
376 391
 * Which buffers to Clear at the beginning of each frame?

Also available in: Unified diff