From owner-freebsd-java@freebsd.org Mon May 16 20:21:13 2016 Return-Path: Delivered-To: freebsd-java@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 501D1B3D677 for ; Mon, 16 May 2016 20:21:13 +0000 (UTC) (envelope-from mizhka@gmail.com) Received: from mail-lb0-x236.google.com (mail-lb0-x236.google.com [IPv6:2a00:1450:4010:c04::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B16B916F5 for ; Mon, 16 May 2016 20:21:12 +0000 (UTC) (envelope-from mizhka@gmail.com) Received: by mail-lb0-x236.google.com with SMTP id ww9so46028137lbc.2 for ; Mon, 16 May 2016 13:21:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=fLWcQqjsDgzO+Zr+SZ9ItkOqcUGrc0C46RFpR5qZH90=; b=XrxqZVjnXjZpduVZpiPK6Cav0I0YTS7tL4p/JAzBxlgJ0T5F8jmG+EX0KFxgszLhym mFE966ipT4HYFt6IKVDh2CpkTJJ1wMWL6l2JMReQ91LoFuYyXuNvW+PzCdMuNM1OYl7V REIoQO0wx69Ss98C7cboTgQd2ilLhsTzDnZsCEkzZbts0UMuREFBqCSwvIfMAehNFWSt 6apKA2wvKCu1iECtoSCWYlnPdX+7O+UMRJMi4dZGlNnnefFwuKT7JUcjgH0zX0Qf0xIl LDRhAU8XQma880ASY6OcCDOHOkM5laycd4p2qvcmeq8j89fwVDoxhkyUz/VeA2K024fP 35yQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=fLWcQqjsDgzO+Zr+SZ9ItkOqcUGrc0C46RFpR5qZH90=; b=UEwyrfvohhq/9nznyN1OlUxlwsno8bEFQf6qQfyPwXO/9TRkQF4SPALgQu6ikjpEIG ZWz8Cmyrq0rxpPpc84erWCiSus9ldLODoknH1IaTKutH4E1ik2S1Yyx3Umns8UKb0TDJ rr5EXMPd1XA07fv6JL7l7rD09aGrDCt3cmekmXqUYrwN6fMLmeF51QGnj+MxLfBInzMl 2QBs19IHJNPhIyeC2n4r0yLNDIif50wRKoVVSnpoUL2DgB4KjJOrSdFJFMNXzqqLx0fo qcyvEmFrwM9OphJN2w8bI7A2ngB3ZO3tvITNuq6MxBPmLyNTJxRs8sr2xnczlVU9lUG6 p/8Q== X-Gm-Message-State: AOPr4FXQ4s6POjq49nIwnx4rL1H0r9CmlrNtSzE/svfJm+0Godwjq6yGJvY2gnvR+1N3MbLj51B8Rrhf6qHBoA== MIME-Version: 1.0 X-Received: by 10.112.220.6 with SMTP id ps6mr12128597lbc.16.1463430070987; Mon, 16 May 2016 13:21:10 -0700 (PDT) Received: by 10.25.152.83 with HTTP; Mon, 16 May 2016 13:21:10 -0700 (PDT) In-Reply-To: <201605161631.u4GGVFc0019850@mech-as222.men.bris.ac.uk> References: <201605161631.u4GGVFc0019850@mech-as222.men.bris.ac.uk> Date: Mon, 16 May 2016 23:21:10 +0300 Message-ID: Subject: Re: java.lang.IllegalArgumentException: Drawable already added to animator From: Michael Zhilin To: mexas@bris.ac.uk Cc: freebsd-java@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 May 2016 20:21:13 -0000 I suppose commenting line 33 may resolve issue. :) Because animator constructor already passed canvas. Thanks! On Mon, May 16, 2016 at 7:31 PM, Anton Shterenlikht wrote: > I advanced a step further. > > I can compile this JOGL program: > > import java.awt.Frame; > import java.awt.event.WindowAdapter; > import java.awt.event.WindowEvent; > import javax.media.opengl.*; > import javax.media.opengl.awt.GLCanvas; > import com.jogamp.opengl.util.*; > > public class SimpleScene implements GLEventListener { > > private double theta = 0; > private double s = 0; > private double c = 0; > > public static void main(String[] args) { > GLProfile glp = GLProfile.getDefault(); > GLCapabilities caps = new GLCapabilities(glp); > GLCanvas canvas = new GLCanvas(caps); > > Frame frame = new Frame("AWT Window Test"); > frame.setSize(300, 300); > frame.add(canvas); > frame.setVisible(true); > > frame.addWindowListener(new WindowAdapter() { > public void windowClosing(WindowEvent e) { > System.exit(0); > } > }); > > canvas.addGLEventListener(new SimpleScene()); > > FPSAnimator animator = new FPSAnimator(canvas, 60); > animator.add(canvas); > animator.start(); > } > > @Override > public void display(GLAutoDrawable drawable) { > update(); > render(drawable); > } > > @Override > public void dispose(GLAutoDrawable drawable) { > } > > @Override > public void init(GLAutoDrawable drawable) { > } > > @Override > public void reshape(GLAutoDrawable drawable, int x, int y, int w, int > h) { > } > > private void update() { > theta += 0.01; > s = Math.sin(theta); > c = Math.cos(theta); > } > > private void render(GLAutoDrawable drawable) { > GL2 gl = drawable.getGL().getGL2(); > > gl.glClear(GL.GL_COLOR_BUFFER_BIT); > > // draw a triangle filling the window > gl.glBegin(GL.GL_TRIANGLES); > gl.glColor3f(1, 0, 0); > gl.glVertex2d(-c, -c); > gl.glColor3f(0, 1, 0); > gl.glVertex2d(0, c); > gl.glColor3f(0, 0, 1); > gl.glVertex2d(s, -s); > gl.glEnd(); > } > } > > with > > $ javac SimpleScene.java > warning: Supported source version 'RELEASE_6' from annotation processor > 'com.jogamp.gluegen.structgen.CStructAnnotationProcessor' less than -source > '1.8' > 1 warning > > but when I run it, I get this error: > > $ java SimpleScene > Exception in thread "main" java.lang.IllegalArgumentException: Drawable > already added to animator: com.jogamp.opengl.util.FPSAnimator[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 false, > jogamp.opengl.x11.glx.X11OnscreenGLXDrawable, > Factory jogamp.opengl.x11.glx.X11GLXDrawableFactory@91161c7, > handle 0x2600020, > Drawable size 286x269 surface[286x269], > AWT[pos 7/24, size 286x269, > visible true, displayable true, showing true, > AWTGraphicsConfiguration[AWTGraphicsScreen[AWTGraphicsDevice[type > .awt, connection :0.0, unitID 0, awtDevice X11GraphicsDevice[screen=0], > handle 0x0], idx 0], > chosen GLCaps[glx vid 0xba, fbc 0x81: rgba 8/8/8/0, opaque, > accum-rgba 0/0/0/0, dp/st/ms 24/8/0, dbl, mono , hw, > GLProfile[GL2/GL2.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[GL2/GL2.hw], on-scr[.]], > X11GraphicsConfig[dev=X11GraphicsDevice[screen=0],vis=0xba], > encapsulated > X11GLXGraphicsConfiguration[X11GraphicsScreen[X11GraphicsDevice[type .x11, > connection :0.0, unitID 0, handle 0x8d73fd800, owner true, > JAWTToolkitLock[obj 0x604ed9f0, isOwner false, <6a4f787b, 685cb137>[count > 0, qsz 0, owner ]]], idx 0], visualID 0xba, fbConfigID 0x81, > requested GLCaps[rgba 8/8/8/0, opaque, accum-rgba 0/0/0/0, > dp/st/ms 16/0/0, dbl, mono , hw, GLProfile[GL2/GL2.hw], on-scr[.]], > chosen GLCaps[glx vid 0xba, fbc 0x81: rgba 8/8/8/0, opaque, > accum-rgba 0/0/0/0, dp/st/ms 24/8/0, dbl, mono , hw, > GLProfile[GL2/GL2.hw], on-scr[.]]]]]] > at com.jogamp.opengl.util.AnimatorBase.add(AnimatorBase.java:201) > at SimpleScene.main(SimpleScene.java:33) > > Anything obvious? > > Thanks > > Anton > _______________________________________________ > freebsd-java@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-java > To unsubscribe, send any mail to "freebsd-java-unsubscribe@freebsd.org" >