Project

General

Profile

« Previous | Next » 

Revision c8d70463

Added by Leszek Koltunski almost 6 years ago

correct oitRenddr again; correct coming to paused state (we could crash)

View differences:

src/main/java/org/distorted/library/main/DistortedObject.java
119 119
    DistortedObject object;
120 120
    int num = mDoneList.size();
121 121

  
122
    for(int i=0; i<num; i++)
122
    try
123
      {
124
      for (int i = 0; i < num; i++)
125
        {
126
        object = mDoneList.removeFirst();
127
        mToDoMap.put(object.mID, object.new Job(object, JOB_CREATE));
128
        object.recreate();
129
        }
130
      }
131
    catch( Exception ex )
123 132
      {
124
      object = mDoneList.removeFirst();
125
      mToDoMap.put(object.mID, object.new Job(object,JOB_CREATE) );
126
      object.recreate();
133
      // something else removed an object in the meantime; ignore
127 134
      }
128 135

  
129 136
    mToDo = true;
src/main/java/org/distorted/library/main/DistortedOutputSurface.java
347 347

  
348 348
  private int oitRender(long currTime, DistortedOutputSurface buffer)
349 349
    {
350
    if( buffer==this )
351
      {
352
      android.util.Log.e("surface", "feedback loop in oitRender!");
353
      return 0;
354
      }
355

  
350 356
    GLES31.glViewport(0, 0, mWidth, mHeight);
351 357
    setAsOutput(currTime);
352 358
    GLES31.glActiveTexture(GLES31.GL_TEXTURE0);
......
354 360
    GLES31.glActiveTexture(GLES31.GL_TEXTURE1);
355 361
    GLES31.glBindTexture(GLES31.GL_TEXTURE_2D, buffer.mDepthStencilH[0]);
356 362

  
357
    DistortedRenderState.enableStencil();
358

  
359
    // we have to unbind DEPTH buffer lest we create a feedback loop
360

  
361
    if( mDepthStencil==BOTH_DEPTH_STENCIL )
362
      {
363
      GLES31.glFramebufferTexture2D(GLES31.GL_FRAMEBUFFER, GLES31.GL_DEPTH_STENCIL_ATTACHMENT, GLES31.GL_TEXTURE_2D, 0, 0);
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);
368
      }
363
    GLES31.glDisable(GLES31.GL_STENCIL_TEST);
364
    GLES31.glStencilMask(0x00);
369 365

  
370 366
    DistortedEffects.oitRender(this, buffer.getWidthCorrection(), buffer.getHeightCorrection() );
371 367

  
372
    if( mDepthStencil==BOTH_DEPTH_STENCIL )
373
      {
374
      GLES31.glFramebufferTexture2D(GLES31.GL_FRAMEBUFFER, GLES31.GL_DEPTH_STENCIL_ATTACHMENT, GLES31.GL_TEXTURE_2D, mDepthStencilH[0], 0);
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
      }
380

  
381 368
    GLES31.glActiveTexture(GLES31.GL_TEXTURE1);
382 369
    GLES31.glBindTexture(GLES31.GL_TEXTURE_2D, 0);
383 370

  
384
    DistortedRenderState.restoreStencil();
385

  
386 371
    return 1;
387 372
    }
388 373

  

Also available in: Unified diff