diff options
| author | Jack Palevich <jackpal@google.com> | 2010-02-03 16:00:49 +0800 |
|---|---|---|
| committer | Jack Palevich <jackpal@google.com> | 2010-02-03 16:00:49 +0800 |
| commit | 66914d4a73fed61ecf56b80c328b30b4fcdcbaef (patch) | |
| tree | df29a344d40242d93603686b63c788ffa3327fe7 /samples/ApiDemos/src/com/example/android/apis/graphics/FrameBufferObjectActivity.java | |
| parent | f8db21698ae9a90ec01e8015fb5d90bc24a3342f (diff) | |
Improve Cube Map and FrameBufferObject samples.
Fix tabs and trailing whitespace.
Expand comment to explain how we search for GL extensions.
Rename and document the DEBUG_RENDER_OFFSCREEN_ONSCREEN variable.
Also make it final static because its value never changes.
Diffstat (limited to 'samples/ApiDemos/src/com/example/android/apis/graphics/FrameBufferObjectActivity.java')
| -rw-r--r-- | samples/ApiDemos/src/com/example/android/apis/graphics/FrameBufferObjectActivity.java | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/FrameBufferObjectActivity.java b/samples/ApiDemos/src/com/example/android/apis/graphics/FrameBufferObjectActivity.java index 0c7bf64ce..e3d4a2839 100644 --- a/samples/ApiDemos/src/com/example/android/apis/graphics/FrameBufferObjectActivity.java +++ b/samples/ApiDemos/src/com/example/android/apis/graphics/FrameBufferObjectActivity.java @@ -48,13 +48,20 @@ public class FrameBufferObjectActivity extends Activity { private Triangle mTriangle; private Cube mCube; private float mAngle; - private boolean mDebugOffscreenRenderer = false; + /** + * Setting this to true will change the behavior of this sample. It + * will suppress the normally onscreen rendering, and it will cause the + * rendering that would normally be done to the offscreen FBO + * be rendered onscreen instead. This can be helpful in debugging the + * rendering algorithm. + */ + private static final boolean DEBUG_RENDER_OFFSCREEN_ONSCREEN = false; public void onDrawFrame(GL10 gl) { checkGLError(gl); if (mContextSupportsFrameBufferObject) { GL11ExtensionPack gl11ep = (GL11ExtensionPack) gl; - if (mDebugOffscreenRenderer) { + if (DEBUG_RENDER_OFFSCREEN_ONSCREEN) { drawOffscreenImage(gl, mSurfaceWidth, mSurfaceHeight); } else { gl11ep.glBindFramebufferOES(GL11ExtensionPack.GL_FRAMEBUFFER_OES, mFramebuffer); @@ -231,8 +238,10 @@ public class FrameBufferObjectActivity extends Activity { String extensions = " " + gl.glGetString(GL10.GL_EXTENSIONS) + " "; // The extensions string is padded with spaces between extensions, but not // necessarily at the beginning or end. For simplicity, add spaces at the - // beginning and end of the extensions string to make it easy to find an - // extension. + // beginning and end of the extensions string and the extension string. + // This means we can avoid special-case checks for the first or last + // extension, as well as avoid special-case checks when an extension name + // is the same as the first part of another extension name. return extensions.indexOf(" " + extension + " ") >= 0; } } |
