JOGL动画问题

时间:2013-07-22 22:14:49

标签: 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)

在设置我的课程路径的教程的第一部分,我找到了jogl-all.jargluegen.jar,但我找不到nativewindow.all.jarnewt.all.jar所以我选择我能找到的最近的jogl-all-natives-windows-amd64.jarnewt-natives-windows-amd64.jar。(我甚至不认为我需要蝾螈,因为我认为只允许我使用标准AWT框架以外的其他类型的框架。正确我,如果我错了。)这可能与问题有关吗?

1 个答案:

答案 0 :(得分:7)

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

Animator animator = new Animator(canvas);
// animator.add(canvas);
animator.start();