JOGL动画问题

nat*_*ala 2 java eclipse jogl

我正在学习使用JOGL,在学习本教程时遇到了一个问题:

在第三个教程上运行代码时,我看到了一个预期的三角形,但它没有移动.我也遇到了这个错误.

Exception in thread "main" java.lang.IllegalArgumentException: Drawable already added to animator: com.jogamp.opengl.util.Animator[started false, animating false, paused false, drawable 1, totals[dt 0, frames 0, fps 0.0], modeBits 1, init'ed true, animThread null, exclCtxThread false(null)], AWT-GLCanvas[Realized true,
    jogamp.opengl.windows.wgl.WindowsOnscreenWGLDrawable,
    Factory   jogamp.opengl.windows.wgl.WindowsWGLDrawableFactory@1e71839,
    handle    0x0,
    Drawable size 292x273,
    AWT pos 4/23, size 292x273,
    visible true, displayable true,
    AWTGraphicsConfiguration[AWTGraphicsScreen[AWTGraphicsDevice[type .awt, connection \Display1, unitID 0, awtDevice D3DGraphicsDevice[screen=1], handle 0x0], idx 1],
    chosen    GLCaps[wgl vid 0x7 arb: rgba 8/8/8/0, trans-rgba 0x0/0/0/0, accum-rgba 16/16/16/16, dp/st/ms 24/0/0, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]],
    requested GLCaps[rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]],
    sun.awt.Win32GraphicsConfig@300ca7[dev=D3DGraphicsDevice[screen=1],pixfmt=7],
    encapsulated WindowsWGLGraphicsConfiguration[DefaultGraphicsScreen[WindowsGraphicsDevice[type .windows, connection decon, unitID 0, handle 0x0, owner false, NullToolkitLock[]], idx 1], pfdID 7, ARB-Choosen true,
    requested GLCaps[rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, dp/st/ms 16/0/0, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]],
    chosen    GLCaps[wgl vid 0x7 arb: rgba 8/8/8/0, trans-rgba 0x0/0/0/0, accum-rgba 16/16/16/16, dp/st/ms 24/0/0, dbl, mono  , hw, GLProfile[GL4bc/GL4bc.hw], on-scr[.]]]]]
    at com.jogamp.opengl.util.AnimatorBase.add(AnimatorBase.java:183)
    at SimpleScene.main(SimpleScene.java:33)
Run Code Online (Sandbox Code Playgroud)

在本教程的第一部分建立我的类路径的时候,我发现了jogl-all.jargluegen.jar,但我无法找到nativewindow.all.jar或者newt.all.jar所以我选择最接近我能找到哪些是jogl-all-natives-windows-amd64.jarnewt-natives-windows-amd64.jar(我甚至不认为我需要蝾螈,因为我认为只允许我使用除标准AWT框架之外的其他类型的框架.如果我错了,请纠正我.)这可能与问题有关吗?

小智 7

在教程中,它看起来像"animator.add(canvas);" 是多余的.只是评论出来.

Animator animator = new Animator(canvas);
// animator.add(canvas);
animator.start();
Run Code Online (Sandbox Code Playgroud)