我正在使用 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/