Project

General

Profile

« Previous | Next » 

Revision 73208cab

Added by Leszek Koltunski over 7 years ago

Debugging Glow.

View differences:

src/main/java/org/distorted/library/effect/PostprocessEffectGlow.java
150 150
      }
151 151

  
152 152
    DistortedFramebuffer  inBuffer = buffers[0];
153
    DistortedFramebuffer outBuffer = buffers[mQualityLevel];
153
    DistortedFramebuffer outBuffer = buffers[1];
154 154

  
155 155
    float w1  = outBuffer.getWidth();
156 156
    float h1  = outBuffer.getHeight();
157
    float w2  =  inBuffer.getWidth();
158
    float h2  =  inBuffer.getHeight();
157 159
    float near= 1.0f - outBuffer.getNear();
158 160

  
159 161
    int radius = (int)(uniforms[index]*mQualityScale);
......
162 164

  
163 165
    int offset = radius + radius*radius/4;
164 166
    radius = (radius+1)/2;
167

  
165 168
    GLES30.glViewport(0, 0, (int)w1, (int)h1);
166 169

  
167 170
    // horizontal glow
......
169 172

  
170 173
    mProgram1.useProgram();
171 174
    outBuffer.setAsOutput();
172
    outBuffer.bindForOutput(1);
175
    outBuffer.bindForOutput(0);
173 176
    inBuffer.setAsInput(0);
174 177

  
175 178
    GLES30.glUniform1f ( mProgram1.mUniform[0] , near);
......
181 184
    GLES30.glVertexAttribPointer(mProgram1.mAttribute[0], POS_DATA_SIZE, GLES30.GL_FLOAT, false, 0, mQuadPositions);
182 185
    GLES30.glVertexAttribPointer(mProgram1.mAttribute[1], TEX_DATA_SIZE, GLES30.GL_FLOAT, false, 0, mQuadTexture);
183 186
    GLES30.glDrawArrays(GLES30.GL_TRIANGLE_STRIP, 0, 4);
187
/*
188
    GLES30.glViewport(0, 0, (int)w2, (int)h2);
184 189

  
185 190
    // vertical glow
186 191
    for(int i=0; i<=radius; i++) mOffsets[i] = offsetsCache[offset+i]/h1;
......
199 204
    GLES30.glVertexAttribPointer(mProgram2.mAttribute[0], POS_DATA_SIZE, GLES30.GL_FLOAT, false, 0, mQuadPositions);
200 205
    GLES30.glVertexAttribPointer(mProgram2.mAttribute[1], TEX_DATA_SIZE, GLES30.GL_FLOAT, false, 0, mQuadTexture);
201 206
    GLES30.glDrawArrays(GLES30.GL_TRIANGLE_STRIP, 0, 4);
202

  
207
*/
203 208
    return 2;
204 209
    }
205 210

  
src/main/java/org/distorted/library/main/DistortedEffects.java
236 236
    return mP.postprocess(surface);
237 237
    }
238 238

  
239
///////////////////////////////////////////////////////////////////////////////////////////////////
240

  
241
  int getNumRenders()
242
    {
243
    return mP.getNumRenders();
244
    }
245

  
246 239
///////////////////////////////////////////////////////////////////////////////////////////////////
247 240

  
248 241
  long getBucket()
src/main/java/org/distorted/library/main/DistortedOutputSurface.java
183 183
      {
184 184
      mBuffer[j] = new DistortedFramebuffer(2,BOTH_DEPTH_STENCIL,TYPE_SYST, (int)(mWidth*mipmap), (int)(mHeight*mipmap) );
185 185
      mBuffer[j].mMipmap = mipmap;
186
      mBuffer[j].mNear   = mNear;  // copy mNear as well (for blitting- see PostprocessEffectBlur.apply() )
186
      mBuffer[j].mNear   = mNear;  // copy mNear as well (for blitting- see PostprocessEffect.apply() )
187 187
      mBuffer[j].glClearColor(1.0f,1.0f,1.0f,0.0f);
188 188
      mipmap *= EffectQuality.MULTIPLIER;
189 189
      }
......
300 300
            }
301 301

  
302 302
          numRenders += currEffects.postprocess(this);
303
          numRenders += blitWithDepth(time, mBuffer[quality]);
303
          numRenders += blitWithDepth(time, mBuffer[1]);
304 304
          }
305 305
        }
306 306

  
src/main/java/org/distorted/library/main/EffectQueuePostprocess.java
90 90
    return mNumEffects>0 ? ((PostprocessEffect)mEffects[0]).getQuality() : 0;
91 91
    }
92 92

  
93
///////////////////////////////////////////////////////////////////////////////////////////////////
94
// TODO: for now, we assume each postprocessing effect issues 2 drawing calls (this is for statistical
95
// purposes only anyway)
96

  
97
  int getNumRenders()
98
    {
99
    return 2*mNumEffects;
100
    }
101

  
102 93
///////////////////////////////////////////////////////////////////////////////////////////////////
103 94

  
104 95
  int postprocess(DistortedOutputSurface surface)

Also available in: Unified diff