Project

General

Profile

« Previous | Next » 

Revision c7da4e65

Added by Leszek Koltunski about 7 years ago

Fix OutputSurface.resize(): before it couldn't be called mid-render.

View differences:

src/main/java/org/distorted/library/DistortedOutputSurface.java
37 37
  float mDistance;
38 38
  float[] mProjectionMatrix;
39 39

  
40
  boolean mDepthEnabled;
40
  int mDepthCreated;
41 41
  int[] mDepthH = new int[1];
42 42
  int[] mFBOH   = new int[1];
43 43

  
44 44
///////////////////////////////////////////////////////////////////////////////////////////////////
45 45

  
46
  DistortedOutputSurface(int width, int height, int color, int fbo, boolean system, boolean depth)
46
  DistortedOutputSurface(int width, int height, int createColor, int createDepth, int fbo, boolean system)
47 47
    {
48
    super(width,height,color,system);
48
    super(width,height,createColor,system);
49 49

  
50 50
    mProjectionMatrix = new float[16];
51 51

  
......
56 56
    mX   =  0.0f;
57 57
    mY   =  0.0f;
58 58

  
59
    mDepthEnabled= depth;
59
    mDepthCreated= createDepth;
60 60
    mFBOH[0]     = fbo;
61
    mDepthH[0]   = color;
61
    mDepthH[0]   = 0;
62 62

  
63 63
    createProjection();
64 64
    }
......
158 158
    {
159 159
    GLES30.glBindFramebuffer(GLES30.GL_FRAMEBUFFER, mFBOH[0]);
160 160

  
161
    if( mDepthEnabled && mDepthH[0]!=NOT_CREATED_YET )
161
    if( mDepthCreated==CREATED )
162 162
      {
163 163
      GLES30.glEnable(GLES30.GL_DEPTH_TEST);
164 164
      GLES30.glDepthMask(true);
......
190 190
///////////////////////////////////////////////////////////////////////////////////////////////////
191 191
/**
192 192
 * Resize the underlying Framebuffer.
193
 * <p>
194
 * This method can be safely called mid-render as it doesn't interfere with rendering.
193 195
 *
194 196
 * @param width The new width.
195 197
 * @param height The new height.
......
205 207

  
206 208
      createProjection();
207 209

  
208
      if( mColorH[0]>0 )
210
      if( mColorCreated==CREATED )
209 211
        {
210 212
        moveToToDo();
211 213
        recreate();
......
222 224
 */
223 225
  public void enableDepth(boolean enable)
224 226
    {
225
    if( mDepthEnabled!=enable )
227
    if( enable && mDepthCreated==DONT_CREATE )
228
      {
229
      mDepthCreated = NOT_CREATED_YET;
230
      moveToToDo();
231
      }
232
    if( !enable && mDepthCreated!=DONT_CREATE )
226 233
      {
227
      mDepthEnabled = enable;
234
      mDepthCreated = DONT_CREATE;
228 235
      moveToToDo();
229 236
      }
230 237
    }
......
237 244
 */
238 245
  public boolean hasDepth()
239 246
    {
240
    return mDepthEnabled;
247
    return mDepthCreated==CREATED;
241 248
    }
242 249

  
243 250
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff