Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
OpenGL Gears in Clojure using JOGL
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  7 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Dustin Withers  
View profile  
 More options Jun 15 2008, 11:09 pm
From: Dustin Withers <fadedd...@gmail.com>
Date: Sun, 15 Jun 2008 20:09:03 -0700 (PDT)
Local: Sun, Jun 15 2008 11:09 pm
Subject: OpenGL Gears in Clojure using JOGL
Hello fellow Clojurer's!

I've posted a ported version of the OpenGL Gears demo that comes with
JOGL. I hope this is the appropriate place to post code like this. It
was really just something to learn a little bit of OpenGL and Clojure.
I pretty much ported the imperative nature of the original code. The
original Java version is considerably faster. I used Refs for the
global variables and I think that maybe what I'm doing wrong but I
couldn't get mutable access to the variables in a proxy any other way.
If anyone has suggestions on how to make it faster/better I'll make
the changes and repost.

http://clojure.googlegroups.com/web/opengl-gears.clj?gda=gTJ_y0EAAABD...

-dustin


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christophe Grand  
View profile  
 More options Jun 16 2008, 4:41 am
From: Christophe Grand <christo...@cgrand.net>
Date: Mon, 16 Jun 2008 10:41:20 +0200
Local: Mon, Jun 16 2008 4:41 am
Subject: Re: OpenGL Gears in Clojure using JOGL
Dustin Withers a écrit :
> I've posted a ported version of the OpenGL Gears demo that comes with
> JOGL.
> If anyone has suggestions on how to make it faster/better I'll make
> the changes and repost.

Hello Dustin,

I can't get it to work (certainly an issue with my JOGL install) but if
you compile your code with *warn-on-reflection* set to true, you'll see
a lot of warnings. You can make them go way by hinting your drawable arg
for each method of the proxy:
      (proxy [GLEventListener] []
        (display [#^javax.media.opengl.GLAutoDrawable drawable]
...

and by hinting the gl arg in the gear function.
(defn gear
  [#^javax.media.opengl.GL gl inner-radius outer-radius width teeth
tooth-depth]

A rule of thumb is that each time you invoke a method on an unhinted arg
you use reflection (unless it's a method of java.lang.Object).

It may help it to run faster.

Christophe


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Robert Feldt  
View profile  
 More options Jun 16 2008, 4:49 am
From: Robert Feldt <robert.fe...@gmail.com>
Date: Mon, 16 Jun 2008 01:49:16 -0700 (PDT)
Local: Mon, Jun 16 2008 4:49 am
Subject: Re: OpenGL Gears in Clojure using JOGL
Nice to have examples of using Clojure and JOGL, thanks. Performance
might increase with type hints.

However, I can't get it to work although I have a fresh JOGL install
and can run the (normal) JOGL demos.

Any hints on how to set things up for it to work properly?

My details:
Mac OS X 10.5.2
Latest clojure from svn

robert_feldt:~/local/java_classpath/jogl-1.1.1-macosx-universal/lib$
java -version
java version "1.5.0_13"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_13-
b05-237)
Java HotSpot(TM) Client VM (build 1.5.0_13-119, mixed mode, sharing)
robert_feldt:~/local/java_classpath/jogl-1.1.1-macosx-universal/lib$
set | grep CLASSP
CLASSPATH=.:/Users/robert_feldt/local/java_classpath/
processing_core.jar:/Users/robert_feldt/local/java_classpath/
jogl-1.1.1-macosx-universal/lib/gluegen-rt.jar:/Users/robert_feldt/
local/java_classpath/jogl-1.1.1-macosx-universal/lib/jogl.jar

Regards,

Robert


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Robert Feldt  
View profile  
 More options Jun 16 2008, 6:04 am
From: Robert Feldt <robert.fe...@gmail.com>
Date: Mon, 16 Jun 2008 03:04:17 -0700 (PDT)
Local: Mon, Jun 16 2008 6:04 am
Subject: Re: OpenGL Gears in Clojure using JOGL
Ok, I got it to work now.

Had to make sure not only the general CLASSPATH was set correct but
the one used in my clj script. Also the DYLD_LIBRARY_PATH env var was
not set correct (not sure why the JOGL demo worked anyway).

The type hints really improves performance noticeably.

Regards,

Robert


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dustin Withers  
View profile  
 More options Jun 16 2008, 12:23 pm
From: Dustin Withers <fadedd...@gmail.com>
Date: Mon, 16 Jun 2008 09:23:34 -0700 (PDT)
Local: Mon, Jun 16 2008 12:23 pm
Subject: Re: OpenGL Gears in Clojure using JOGL
On Jun 16, 3:41 am, Christophe Grand <christo...@cgrand.net> wrote:

> I can't get it to work (certainly an issue with my JOGL install) but if
> you compile your code with *warn-on-reflection* set to true, you'll see
> a lot of warnings.

Christophe,

Thank you very much for the help. The type hints do indeed help with
speed. I have one question though. How do I set *warn-on-reflection*
to true? Using (def *warn-on-reflection* true) I get the following
error:

Name conflict, can't def *warn-on-reflection* because namespace: user
refers to:#'clojure/*warn-on-reflection*
  [Thrown class java.lang.Exception]

Thanks,
-dustin


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Christophe Grand  
View profile  
 More options Jun 16 2008, 12:41 pm
From: Christophe Grand <christo...@cgrand.net>
Date: Mon, 16 Jun 2008 18:41:20 +0200
Local: Mon, Jun 16 2008 12:41 pm
Subject: Re: OpenGL Gears in Clojure using JOGL
Dustin Withers a écrit :
> Thank you very much for the help. The type hints do indeed help with
> speed. I have one question though. How do I set *warn-on-reflection*
> to true? Using (def *warn-on-reflection* true) I get the following
> error:

> Name conflict, can't def *warn-on-reflection* because namespace: user
> refers to:#'clojure/*warn-on-reflection*
>   [Thrown class java.lang.Exception]

In the REPL, (set! *warn-on-reflection* true).
If you are using Script:
(in-ns 'clojure)
(def *warn-on-reflection* true)
(in-ns 'user) ; or whatever is your namespace
(your-code)

Christophe


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dustin Withers  
View profile  
 More options Jun 16 2008, 5:30 pm
From: Dustin Withers <fadedd...@gmail.com>
Date: Mon, 16 Jun 2008 14:30:13 -0700 (PDT)
Local: Mon, Jun 16 2008 5:30 pm
Subject: Re: OpenGL Gears in Clojure using JOGL
I've updated the Gears Demo with hints and a small macro to wrap the
glBegin and glEnd statements. It's working much better now.

Enjoy!
-dustin

On Jun 15, 10:09 pm, Dustin Withers <fadedd...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »