java - 整形时闪烁

标签 java opengl jogl

我正在使用 FPSAnimator 和 jogl 在 GLCanvas 上绘制旋转四边形。通常图形不会闪烁并且旋转很平滑,但是当我调整窗口大小时,或者将它从屏幕的不可见区域移动到可见区域时,会添加额外的重绘请求。我如何过滤掉这些额外的请求,因为所有绘图都是由 FPSAnimator 完成的

最佳答案

您可以尝试在命令行中将参数:-Dsun.awt.noerasebackground=true 传递给JVM。这应该可以减少/消除闪烁。

问题在 JoglUserGuide 上有描述

具体来说:

Another issue that occasionally arises on Windows is flickering during live resizing of a GLCanvas. This is caused by the AWT's repainting the background of the Canvas and can not be overridden on a per-Canvas basis, for example when subclassing Canvas into GLCanvas. The repainting of the background of Canvases on Windows can be disabled by specifying the system property -Dsun.awt.noerasebackground=true. Whether to specify this flag depends on the application and should not be done universally, but instead on a case-by-case basis. Some more detail is in the thread "TIP: JOGL + Swing flicker" in the JOGL forum.

关于java - 整形时闪烁,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5926999/

相关文章:

java - Dagger2 - 在不复制代码的情况下注入(inject)替换模块

java - 将字符串转换为整数和字符

java - 二叉搜索树中的重复项

c++ - 通过数组绘制对象

java - JOGL 中的交错数据

java - 当代理移动时,旋转形状与相机一起移动

java - 将对象编码为 xml 并删除 xmlns

opengl - 什么时候应该调用 glVertexAttribPointer?

c++ - 使用 GlDrawElements() 绘制立方体?

java - 在线框中绘制隐藏线作为点画