Project

General

Profile

« Previous | Next » 

Revision a9f41fa3

Added by Leszek Koltunski almost 8 years ago

New 'glClearColor' and 'glClearDepthf' APIs in OutputSurface. This fixes the 'transparency' regressions from last commit.

View differences:

src/main/java/org/distorted/library/DistortedOutputSurface.java
40 40
  int[] mDepthH = new int[1];
41 41
  int[] mFBOH   = new int[1];
42 42

  
43
  private float mClearR, mClearG, mClearB, mClearA;
44
  private float mClearDepth;
45

  
43 46
///////////////////////////////////////////////////////////////////////////////////////////////////
44 47

  
45 48
  abstract DistortedFramebuffer getBuffer();
......
64 67

  
65 68
    mTime = 0;
66 69

  
70
    mClearR = 0.0f;
71
    mClearG = 0.0f;
72
    mClearB = 0.0f;
73
    mClearA = 0.0f;
74

  
75
    mClearDepth = 1.0f;
76

  
67 77
    createProjection();
68 78
    }
69 79

  
......
239 249
      {
240 250
      mTime = time;
241 251
      DistortedRenderState.colorDepthOn();
242
      GLES30.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
252
      GLES30.glClearColor(mClearR, mClearG, mClearB, mClearA);
253
      GLES30.glClearDepthf(mClearDepth);
243 254
      GLES30.glClear( GLES30.GL_DEPTH_BUFFER_BIT | GLES30.GL_COLOR_BUFFER_BIT);
244 255
      }
245 256
    }
246 257

  
258
///////////////////////////////////////////////////////////////////////////////////////////////////
259
/**
260
 * Set the (R,G,B,A) values of GLES30.glClearColor() to set up color with which to clear
261
 * this Surface before each render.
262
 *
263
 * @param r the Red component. Default: 0.0f
264
 * @param g the Green component. Default: 0.0f
265
 * @param b the Blue component. Default: 0.0f
266
 * @param a the Alpha component. Default: 0.0f
267
 */
268
  public void glClearColor(float r, float g, float b, float a)
269
    {
270
    mClearR = r;
271
    mClearG = g;
272
    mClearB = b;
273
    mClearA = a;
274
    }
275

  
276
///////////////////////////////////////////////////////////////////////////////////////////////////
277
/**
278
 * Set the Depth value of GLES30.glClearDepthf() to set up depth with which to clear
279
 * the Depth buffer of Surface before each render.
280
 *
281
 * @param d the Depth. Default: 1.0f
282
 */
283
  public void glClearDepthf(float d)
284
    {
285
    mClearDepth = d;
286
    }
287

  
247 288
///////////////////////////////////////////////////////////////////////////////////////////////////
248 289
/**
249 290
 * Create new Projection matrix.

Also available in: Unified diff