页面翻页时出现奇怪的闪烁光线

5
我正在使用Harism在https://github.com/harism/android_page_curl上创建的页面翻页动画。我将他的动画实现到我的Android电子书阅读器应用程序中,问题是当我快速翻页时,有时会出现奇怪的闪烁白光。然而,当我正常翻页时就没有这种情况了。我认为问题出在OpenGL方面。虽然我不熟悉这项技术,但在调试过程中我发现,在页面翻页完成后CurlRenderer类的onDrawFrame方法仍在进行一些绘图过程。
    @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


你好,您能同时发布视频吗?从这个描述中很难猜出问题所在。另外,您测试的是哪种移动设备?您尝试过多个设备吗? - the swine
我明白了。您所指的效果是整个屏幕变灰,或者在页面左侧看到亮部分吗?您能否向我们展示如何从tap/slide事件处理程序中调用curl? - the swine
1
我建议您编译并运行curl示例项目,不添加或修改任何内容,以查看是否也会出现此问题。如果是,则是curl中的错误。如果不是,我们将从那里开始。 - the swine
2
我从日志中看到,一些 onDrawFrame 调用实际上是在下一个调用开始后返回的(例如比较第2和第3个日志条目的时间)。我认为这里可能涉及某种多线程/同步问题。 - Pavel Beliy
1
@LOG_TAG 是的,在所有设备上都出现了。 - support_ms
显示剩余11条评论
1个回答

0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接