Wednesday, June 29, 2011

Work completed 06/23 - 06/29

Working on creating bucky ball functionality within  the wigwam applet.  This functionality is based on functionality for creating circles on the 3d graph display.  This required the following steps completed over the course of the week:

1.  review Bresenham's algorithm for selecting pixels to approximate circular arcs.  Using the following text as reference:  Computer Graphics for Java Programmers
2.  review concepts for creating 3d perspective (as opposed to 2d graphics).  Using same text as above as reference.
3.  review concepts for creating 3d perspective using jogl library.  Using the following text as reference:  Foundations of 3D Graphics Programming Using JOGL and Java 3D
4.  review wigwam code for creating arcs (specifically the drawArc function of the WigWam class).  This is where the meat of the arc point calculations are performed.

Looking to leverage this code to create circular arcs, then create circular arcs of different angles of rotation about the z axis.

Wednesday, June 22, 2011

Work completed 06/16 - 06/22

Began work on enhancement to Wigwam applet for making horizontal arcs, per the direction from the email below:


---------------------------- Original Message ----------------------------
Subject: RE: weekly update
From:    "Eglash, Ron" <eglash@rpi.edu>
Date:    Thu, June 16, 2011 10:24 pm
To:      johnsj3@cs.rpi.edu
--------------------------------------------------------------------------

Lets take this one step at a time. First step: allow "horizontal" arcs
so the kids can make the part of the wigwam that wraps around the
middle. Then we will worry about buckyballs.

Currently the applet only allows arcs that are "vertical". The user can
only rotate the arc around the Y axis. (Of course we don't mean just the
single Y axis at x=0, z=0. Rather we mean any line running parallel to
the Y axis.)

We need two more degrees of freedom:

1)    Such that the user can rotate the arc around the X axis (Of course
we don't mean just the single X axis at y=0, z=0. Rather we mean any
line running parallel to the X axis. And since they can rotate around Y,
that means it could even be parallel to the Z axis.).

2)    Such that the user can move the arc up higher or lower. We will
need to make sure the labels distinguish this from the parameter that
determine how tall the arc will be,

*****end email************************************
The approach is to leverage code for current functionality for making horizontal arcs.  Attempting to modify existing code to make it sufficiently generic to support both elements of functionality - making vertical arcs and horizontal arcs.  Once this is complete, will address the issue of being able to rotate the arc around the x-axis, hopefully, using code similar to that for rotating around the y-axis.  Finally, linear translation of the axis of axis will be modified/leveraged in the existing code base for supporting vertical translation of the axis for horizontal arcs.  

Wednesday, June 15, 2011

Work completed 06/09 - 06/15

1.  Beginning work on Buckyballs creation.  Need to discuss how this should be used as an instructional tool for the students.  Do we want to use it in a way similar to the way we use the Wigwam applet - where students build a design using the applet and then use the coordinates it creates to build an actual model using styrofoam and bendy wire?  I'm not sure how this would work when constructing a buckyball.  Would we be ok to simply extend this approach so that the student's model consists of bendy wire bi-sected by a styrofoam plane?  Is there a better approach?  If so, what ramifications does this have for the applet creating buckyballs?  If we come up with a separate approach, our decision on approach will imply taking one of the following approaches - 1. incorporating the code into the existing wigwam applet code, 2.  a different applet (but based on the code for wigwam) or 3.  a different applet, developed completely independently of wigwam logic.  Thoughts on this?

2.  Also, started looking into execution issues on netbooks.  Currently I possess two netbooks from the last workshop - one on which the Wigwam applet works correctly and the other on which it does not.  The hope is to isolate the difference between them that's causing the problem.  Hopefully, will determine the cause of this in the next couple days.

3.  Determined source of issues related to installation of Wigwam project on local workstation that prevented execution of code within NetBeans on local workstation.  Summarized issues on post for 06/13.  Documented detailed steps for future developers who may work on this project to lower future startup costs.  Contents of README.txt (located in WigwamV2 folder of project is as follows):

****************************README.txt********************************************

-------------------------
Wigwam Project Configuration
-------------------------

Overview

The Wigwam project source code makes heavy use of the Java OpenGL (JOGL) libraries for graphics support.  These libraries will need to be installed properly on any workstation where development for the Wigwam project is to occur.  Configuration instructions are below.  The official site for downloading the JOGL libraries can be found by going to http://schabby.de/jogl-download/.  However, all of the JOGL binaries for supporting the Wigwam project can be found on the svn server in a zip file called libs.zip on the csdt svn server.  This is the recommended location for downloading since this guarantees proper versioning compatibility with the source code of the Wigwam project.

Configuration instructions

I.  Install JOGL support libraries

1.  Download the libs.zip from the csdt svn server.  It's in the parent directory, a sibling of the other csdt projects on the csdt svn server.
2.  Unzip the file and install the files in the jogl directory to a directory on the local workstation.  For example, install them in c:\java\jogl\lib.  The files selected should include the following:

jogl.jar
gluegen-rt.jar
jogl.dll
jogl_cg.dll
jogl_awt.dll
gluegen-rt.dll
libjogl.jnilib
libgluegen-rt.jnilib
libjogl_cg.jnilib
libjogl_awt.jnilib

The jar files are contain compiled java source code modules, .class files.  The .dll files are libraries for calling graphics routines native to the operating system platform.  The .jnilib files contain functions that resolve calls in the .class files and the routines in the .dll files.

3.  Add the directory from step 2 to the PATH environment variable (on Windows), or the corresponding environment variable if on a UNIX system.  This environment variable will allow the operating system to find the .dlls listed above whose routines are called by the JVM at runtime.

II.  Install the Wigwam project.

1.  Download the Wigwam project from the csdt svn server.
2.  Open the project in NetBeans by navigating to the ..\VirtualWigwam\WigwamV2 directory in the Open Project dialog.
3.  Once the project is open, reset the JOGL library to reference to the local installation of the jogl.jar file, (installed in part I above).  This file should have been in the the libs.zip.
4.  Reset the GLUEGEN-RT libary to reference the gluegen-rt.jar installed locally from libs.zip.
6.  Right click on the project in the project explorer window and select properties.  In the project properties window, under the WebStart node, set the AppletDescriptor/Applet Class to wigwam.WigwamApplet, (NOT wigwam.Wigwam).
7.  In the project properties window, click on the Applet parameters button.  Set the width and height dimensions to 900.

"Gotchas" that can cost a lot of time configuring this project

1.  There are other versions of jogl on the internet.  These don't necessarily work with the current version of the Wigwam applet.  For example, there is a package at http://csis.pace.edu/~marchese/CG/JOGL/Jogl1l.htm.    Don't be lured into downloading the jogl deployment package at this site - it won't help because of incompatibility with the Wigwam project and will only lead to trouble.  Such packages may have a different interface but some commonality, (just to further confuse things) from the version required by the Wigwam applet.

2.  In order to prevent confusion, make sure only one version of JOGL is installed on the local workstation.  Multiple installations can cause havoc with the PATH environment variable since Windows will search through the path only until it finds a dll with a matching name.  If there are multiple such files with the same name, the directory to the wrong one may be listed first in the PATH variable, and trouble will ensue.

3.  Make sure the Applet class is wigwam.WigwamApplet, not wigwam.Wigwam.  Both of these classes extend JApplet, and thus, constitute applets.  However, in order for this project to render correctly in the browser, the applet class needs to be WigwamApplet.

III.  Test the applet.

1.  Compile the project. (Shift-F11 in NetBeans.)
2.  In the Files explorer window, navigate to dist/launch.html, right click, and select launch.html from the pop-up menu.  This will fire up the default browser and the applet should be rendered from the local workstation.
3.  Also, as an alternative, the applet can be kicked off in the applet viewer by right clicking on the WigwamApplet.java class in the project explorer window and selecting Run File.

**********************End README.txt**********************************************

Monday, June 13, 2011

Update 06/13/2011

The wigwam applet is now compiling AND EXECUTING properly on my local workstation.  See picture below:


The key configuration elements in order to arrive at successful execution are as follows:

1.  Add a library to the project called JOGL referencing the jogl.jar file from libs.zip.
2.  Add a library to the project called GLUEGEN-RT referencing the gluegen-rt.jar from libs.zip.
3.  Ignore/delete the libary, JOgl in the project.
4.  Load the following files into a local folder on the workstation (all from libs.zip):  jogl.dll, jogl_cg.dll, jogl_awt.dll, gluegen-rt.dll, libjogl.jnilib, libgluegen-rt.jnilib, libjogl_cg.jnilib, libjogl_awt.jnilib.
5.  Add the directory in which the files of step 4 were placed to the Windows PATH environment variable.
6.  In the project properties window, under the WebStart node, set the AppletDescriptor/Applet Class to wigwam.WigwamApplet, (NOT wigwam.Wigwam).

"Gotchas" that cost a lot of time in figuring this out:

1.  There are other versions of jogl on the internet.  These don't necessarily work with the current version of the Wigwam applet.  One version that I made the mistake of trying to use during experimentation (based on a search for jogl_cg.dll) is at http://csis.pace.edu/~marchese/CG/JOGL/Jogl1l.htm.    Don't be lured into downloading the jogl deployment package at this site - it won't help you and will only serve to confuse the issue!!!!  This version has a DIFFERENT INTERFACE (but some commonality, just to further confuse things) from the version required by the Wigwam applet.  Also, it does not have the required gluegen_rt.jar, gluegen_rt.dll, and the jni libraries required for the graph of the Wigwam applet.

2.  Even when it is known that the two libraries, (the one in libs.zip and the one from the site given above), are different, one must be careful about the way in which the directories to which the libraries are installed are ordered in the PATH environment variable.  That is, even though the path to the correct set of libraries (from libs.zip) was included in the PATH variable, that directory was listed AFTER the directory for the one for the package downloaded from the marchese site, which meant that the OS would resolve function calls to the wrong libraries because their names/some elements of interface matched in the wrong files.  Once the directory to the marchese package was deleted, the function calls were resolved correctly by the OS.

3.  As alluded to in item 6 of the configuration element list given above, make sure the Applet class is wigwam.WigwamApplet, not wigwam.Wigwam.  This setting was created when I first created the project after downloading the code from svn for the first time, before I became acquainted with how the code was organized.  Even though both classes extend JApplet, only WigwamApplet actually has event code for establishing the complete interface (init(), start(), etc.)  This setting had to be rediscovered/changed to WigwamApplet.

4.  It seems that the code will compile without gluegen-rt.jar.  However, strangely, in order for the code to *execute* properly, gluegen-rt.jar must be referenced in the project.

WHEW!!!!!  that was painful, but it's behind us........

Saturday, June 11, 2011

Update 06/11/2011

In an effort to make the current state of my development environment configuration clear, I will describe the steps I've taken (separate from other diagnostic experiments I have conducted) to set up the development environment for the Wigwam project.  they are listed below.  Keep in mind, these steps are based on the documentation provided in the Userguide.html provided as part of the jogl library contained in the libs.zip file on the svn server (a screen shot of the actual jogl installation instructions is given below):


Based on these instructions I took the following steps:

1.  Add a library to the NetBeans Wigwam project call JOGL that references the jogl.jar file.
2.  Add a library to the NetBeans Wigwam proejct called GLUEGEN-RT that references the gluegen-rt.jar file.
3.  Add a directory to the PATH environment variable (Windows Vista is the OS) that contains the following files:


gluegen-rt.dll
jogl.dll
jogl_awt.dll
jogl_cg.dll
libgluegen-rt.jnilib
libjogl.jnilib
libjogl_awt.jnilib
libjogl_cg.jnilib

These steps produce the environment that allow compilation but not proper execution - the view of the launch.html produces the x box (no applet) shown in the prior post on 06/09.  What step(s) am I missing?  Any comments are much appreciated.  Thank you!!!!!

Looking at possible addition of entries in the NetBeans environment for PATH (but this shouldn't be needed given we're dealing with an applet running in a browser, not actual NetBeans runtime).

Thursday, June 9, 2011

Update 06/09/2011

The nature of the problem rendering the applet is given below.  As mentioned in my prior post, the compilation process works fine.  (By the way, I notice that there are multiple versions of jogl.dll out there - two of which I have installed on my machine (not realized until started fiddling with them) - wigwam requires the version where GLEventListener is part of the com.javax.media package while there's another where the GLEventListener is part of the net.java.games.jogl package.  Given the fundamental nature by which these versions differ (same class in completely different packages) not surprisingly, the wigwam project won't compile with the second one, only the first, and other projects which I've been experimenting with to get this to work require the other one.)

Anyway, after compilation of the wigwam project, in NetBeans, I go to render it in the browser by navigating to the Files exporer window for the project, selecting the launch.html (created during compilation),  right-clicking on the file, and selecting "View" from the pop-up menu.  This process yields the following:


This problem is likely due to a configuration error associated with jogl.  My workstation is configured as follows:

1.  The wigwam project includes a reference to jogl.jar.
2.  The java sdk bin directory, jdk1.6.0_21/bin, has the following dlls in it:  jogl.dll, jogl_cg.dll.

I have tried creating various other simple (non-applet) projects that verify the usefulness of jogl.jar, jogl.dll, jogl_cg.dll - that is by adding them and removing them and seeing how that affects the compilation and execution of the non-applet test project.  As expected, jogl.jar is required for proper compilation of the test project, jogl.dll, jogl_cg.dll is required for proper execution of the non-applet project.  It was never required to actually have the jogl_rt.dll installed.  However, this may be because the simple code did not require it.  However,  I followed instructions downloaded  from http://csis.pace.edu/~marchese/CG/JOGL/Jogl1l.htm, which did not indicate this was necessary.  However, is it possible this site is outdated?

In order to make sure that there is nothing wrong with the NetBeans installation and its interaction with the Google Chrome browser, I created a simple HelloWorld applet that renders correctly as follows:


So, this verifies that the basic installation of NetBeans, Chrome, the java virtual machine in the browser are all running properly.  This leaves some element of the installation of JOGL libraries.

Based on this, other things I've thought of trying include the following:

1.  Try other version of jogl.dll (that goes with other version of the jogl.jar).
2.  Add gluegen-rt.jar to the mix.  Is this jar required after all - certainly the wigwam code compiles without it.
3.  Add gluegen-rt.dll to the jdk1.6.0_u21/bin folder.

Again, emails with the prior developer Clayton did not indicate a need for gluegen-rt, nor did documentation found on the internet, but since nothing is working, I'm open to any ideas.

Any other suggestions are welcome.

Wednesday, June 8, 2011

Work completed 05/31 - 06/08

Currently working on a problem getting the wigwam applet to run on my local workstation.  The project compiles fine, but does not render from the locally built project in the browser.  Still trying to figure out why.

Reviewed information provided in prior developer's email regarding library references in the NetBeans project.  His libraries do not align with those in the publicly available folder on the svn site for CSDT.  That is, Clayton has  libraries including jogl.dll, jogl-cg.dll, and jogl-awt.dll, whereas the ones provided in the zip on the server are jogl.dll and gluegen-rt.dll.  Have researched the jogl-cg.dll and jogl-awt.dll on the internet.  Turned up a site that discusses installation of JOGL on a workstation that is focused on jogl-cg.dll, jogl.dll, and yet another file, jogl.jar.  The documentation is inconsistent with that provided in the zip on the svn server which focuses on the other three files listed above.  Based on this documentation, I have created a few introductory, elementary projects using jogl.jar, jogl.dll, and jogl-cg.dll on the local workstation.  However, I have not tried yet to see if this installation will work for the wigwam project.

Next step is to create an applet project (as opposed to a regular Java application) in NetBeans using JOGL and see if this renders properly in the browser.  If that works, then will try to render the wigwam project using this installation.  Otherwise, will be researching further...