gpt4 book ai didi

android - 页面 curl 时出现奇怪的闪电

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:26:24 27 4
gpt4 key购买 nike

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

    @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

当日志的第一行出现时,书的页面完成 curl 比方说 02-20 07:27:37.320 在这种情况下,但在接下来的几行中,您可以看到 onDrawFrame 方法被连续调用。也许当此方法尚未完成时我正在 curl 页面它的工作和闪电开关来自那个故障?有帮助吗?这是您可以看到的视频链接,有时会出现闪电 http://www.youtube.com/watch?v=HPJ2U18Caok&feature=youtu.be

最佳答案

其他可能的解决方案:

尝试使用Render Script翻页!

enter image description here

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

也看看这个 Awesome page curl lib与 Page Turner 一起!

更多来源:

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

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

关于android - 页面 curl 时出现奇怪的闪电,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21896954/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com