页卷曲奇怪的闪电

我使用由Harism在https://github.com/harism/android_page_curl创建的页面卷曲动画。我已经将他的动画实现到了我的电子书阅读器应用程序中,问题是当我快速地滑动页面时,有时会很奇怪白色照明切换。 但是,当我正常卷曲页面时,并不存在这种情况。 我认为问题出在OpenGL方面。我不熟悉该技术,但在调试过程中,我看到在页面卷曲完成后,仍然有一些绘图过程在onDrawFrame方法上进行CurlRenderer类。

    @Override
    public synchronized void onDrawFrame(final GL10 gl) {
        mObserver.onDrawFrame();
        gl.glClearColor(Color.red(mBackgroundColor) / 255f,
                Color.green(mBackgroundColor) / 255f,
                Color.blue(mBackgroundColor) / 255f,
                Color.alpha(mBackgroundColor) / 255f);
        gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
        gl.glLoadIdentity();
        if (USE_PERSPECTIVE_PROJECTION) {
            gl.glTranslatef(0, 0, -6f);
        }
        for (int i = 0; i < mCurlMeshes.size(); ++i) {

            mCurlMeshes.get(i).onDrawFrame(gl);
        }
        Calendar now = Calendar.getInstance();
        int minute = now.get(Calendar.MINUTE);
        int second = now.get(Calendar.SECOND);
        int millis = now.get(Calendar.MILLISECOND);
        Log.i("time curl renderer (onDrawFrame) : ", minute + ":" + second + "." + millis);
    }

以下是日志

02-20 07:27:37.320  30215-30407/org.com.ebook I/time curl renderer (onDrawFrame) :﹕ 27:37.326
02-20 07:27:37.328  30215-30407/org.com.ebook I/time curl renderer (onDrawFrame) :﹕ 27:37.336
02-20 07:27:37.335  30215-30407/org.com.ebook I/time curl renderer (onDrawFrame) :﹕ 27:37.344
02-20 07:27:37.343  30215-30407/org.com.ebook I/time curl renderer (onDrawFrame) :﹕ 27:37.354
02-20 07:27:37.359  30215-30407/org.com.ebook I/time curl renderer (onDrawFrame) :﹕ 27:37.367
02-20 07:27:37.367  30215-30407/org.com.ebook I/time curl renderer (onDrawFrame) :﹕ 27:37.377
02-20 07:27:37.375  30215-30407/org.com.ebook I/time curl renderer (onDrawFrame) :﹕ 27:37.387
02-20 07:27:37.390  30215-30407/org.com.ebook I/time curl renderer (onDrawFrame) :﹕ 27:37.399
02-20 07:27:37.398  30215-30407/org.com.ebook I/time curl renderer (onDrawFrame) :﹕ 27:37.410
02-20 07:27:37.414  30215-30407/org.com.ebook I/time curl renderer (onDrawFrame) :﹕ 27:37.422
02-20 07:27:37.421  30215-30407/org.com.ebook I/time curl renderer (onDrawFrame) :﹕ 27:37.432
02-20 07:27:37.437  30215-30407/org.com.ebook I/time curl renderer (onDrawFrame) :﹕ 27:37.444
02-20 07:27:37.445  30215-30407/org.com.ebook I/time curl renderer (onDrawFrame) :﹕ 27:37.455
02-20 07:27:37.453  30215-30407/org.com.ebook I/time curl renderer (onDrawFrame) :﹕ 27:37.465
02-20 07:27:37.468  30215-30407/org.com.ebook I/time curl renderer (onDrawFrame) :﹕ 27:37.477
02-20 07:27:37.476  30215-30407/org.com.ebook I/time curl renderer (onDrawFrame) :﹕ 27:37.487
02-20 07:27:37.492  30215-30407/org.com.ebook I/time curl renderer (onDrawFrame) :﹕ 27:37.501
02-20 07:27:37.500  30215-30407/org.com.ebook I/time curl renderer (onDrawFrame) :﹕ 27:37.509
02-20 07:27:37.515  30215-30407/org.com.ebook I/time curl renderer (onDrawFrame) :﹕ 27:37.520
02-20 07:27:37.523  30215-30407/org.com.ebook I/time curl renderer (onDrawFrame) :﹕ 27:37.532
02-20 07:27:37.531  30215-30407/org.com.ebook I/time curl renderer (onDrawFrame) :﹕ 27:37.542
02-20 07:27:37.546  30215-30407/org.com.ebook I/time curl renderer (onDrawFrame) :﹕ 27:37.555
02-20 07:27:37.554  30215-30407/org.com.ebook I/time curl renderer (onDrawFrame) :﹕ 27:37.565
02-20 07:27:37.570  30215-30407/org.com.ebook I/time curl renderer (onDrawFrame) :﹕ 27:37.576
02-20 07:27:37.578  30215-30407/org.com.ebook I/time curl renderer (onDrawFrame) :﹕ 27:37.588
02-20 07:27:37.585  30215-30407/org.com.ebook I/time curl renderer (onDrawFrame) :﹕ 27:37.598
02-20 07:27:37.601  30215-30407/org.com.ebook I/time curl renderer (onDrawFrame) :﹕ 27:37.610
02-20 07:27:37.609  30215-30407/org.com.ebook I/time curl renderer (onDrawFrame) :﹕ 27:37.619
02-20 07:27:37.617  30215-30407/org.com.ebook I/time curl renderer (onDrawFrame) :﹕ 27:37.629 

当第一行日志出现时,本书的页面完成卷曲让我们说02-20 07:27:37.320在这种情况下,但在接下来的行中,您可以看到onDrawFrame方法被称为连续的。也许我在此方法不卷曲时卷曲页面完成它的工作,并从该故障来的减轻开关? 任何帮助?这里是视频的链接,你可以在那里看到有时会出现闪电http://www.youtube.com/watch?v=HPJ2U18Caok&feature=youtu.be


其他可能的解决方

尝试使用渲染脚本页面卷曲!

在这里输入图像描述

(Renderscript是一种语言,API和运行时库,可用于实现Android应用程序的高性能渲染和计算。请参阅Jason Sams的介绍性文章,介绍Renderscript和Renderscript第2部分。)

还可以看看这个带有Page Turner的Awesome页面卷曲库!

更多来源:

http://www.zeropointnine.com/blog/3d-page-curl-effect-updated/

http://www.doubleencore.com/2013/10/renderscript-for-all/

链接地址: http://www.djcxy.com/p/87147.html

上一篇: Strange lightening on page curl

下一篇: Android emulator GPU on for NDK apps