Revision 86e99907
Added by Leszek Koltunski almost 7 years ago
src/main/java/org/distorted/library/DistortedOutputSurface.java | ||
---|---|---|
21 | 21 |
|
22 | 22 |
import android.opengl.GLES30; |
23 | 23 |
import android.opengl.Matrix; |
24 |
|
|
24 | 25 |
import java.util.ArrayList; |
25 | 26 |
|
26 | 27 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
27 | 28 |
|
28 | 29 |
abstract class DistortedOutputSurface extends DistortedSurface implements DistortedSlave |
29 | 30 |
{ |
31 |
//////////// DEBUG FLAGS ///////////////////////////////////////////// |
|
32 |
/** |
|
33 |
* When rendering a Screen, show FPS in the upper-left corner? |
|
34 |
*/ |
|
35 |
public static final int DEBUG_FPS = 1; |
|
36 |
//////////// END DEBUG FLAGS ///////////////////////////////////////// |
|
37 |
|
|
30 | 38 |
/** |
31 | 39 |
* Do not create DEPTH or STENCIL attachment |
32 | 40 |
*/ |
... | ... | |
82 | 90 |
private int mClear; |
83 | 91 |
float mMipmap; |
84 | 92 |
|
93 |
private int mDebugLevel; |
|
94 |
|
|
95 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
96 |
|
|
97 |
abstract void prepareDebug(long time); |
|
98 |
abstract void renderDebug(long time); |
|
99 |
|
|
85 | 100 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
86 | 101 |
|
87 | 102 |
DistortedOutputSurface(int width, int height, int createColor, int numcolors, int depthStencil, int fbo, int type) |
... | ... | |
100 | 115 |
mDepthStencilH[0]= 0; |
101 | 116 |
|
102 | 117 |
mTime = 0; |
118 |
mDebugLevel = 0; |
|
103 | 119 |
|
104 | 120 |
mClearR = 0.0f; |
105 | 121 |
mClearG = 0.0f; |
... | ... | |
309 | 325 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
310 | 326 |
// PUBLIC API |
311 | 327 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
328 |
/** |
|
329 |
* Make the library show various debugging information. |
|
330 |
* <p> |
|
331 |
* Currently only DEBUG_FPS - show FPS in the upper-left corner of every Screen - is defined. |
|
332 |
* |
|
333 |
* @param bitmask 0, or a bitmask of DEBUG_** flags to enable (currently only DEBUG_FPS defined) |
|
334 |
*/ |
|
335 |
public void setDebug(int bitmask) |
|
336 |
{ |
|
337 |
mDebugLevel = bitmask; |
|
338 |
} |
|
339 |
|
|
340 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
341 |
|
|
312 | 342 |
/** |
313 | 343 |
* Draws all the attached children to this OutputSurface. |
314 | 344 |
* <p> |
... | ... | |
319 | 349 |
*/ |
320 | 350 |
public int render(long time) |
321 | 351 |
{ |
352 |
boolean showDebug = ( mDebugLevel!=0 && this instanceof DistortedScreen ); |
|
353 |
|
|
354 |
if( showDebug ) prepareDebug(time); |
|
355 |
|
|
322 | 356 |
// change tree topology (attach and detach children) |
323 | 357 |
/* |
324 | 358 |
boolean changed1 = |
... | ... | |
363 | 397 |
setAsOutput(time); |
364 | 398 |
numRenders += renderChildren(time,mNumChildren,mChildren); |
365 | 399 |
|
366 |
if( Distorted.mDebugLevel!=0 && this instanceof DistortedScreen ) |
|
367 |
{ |
|
368 |
Distorted.mDebug.renderFPS(time,this); |
|
369 |
} |
|
400 |
if( showDebug ) renderDebug(time); |
|
370 | 401 |
|
371 | 402 |
return numRenders; |
372 | 403 |
} |
Also available in: Unified diff
Correct the FPS work (now works even after a Pause() ! )