Monday, June 28, 2010

Add reflection and some methods to Cornrow Curve

Task: Add reflection and some other methods to Cornrow Curve
Date: 0624-06301.

1. Add the functionality: Reflection about X-axis, Y-axis or both
The logic for adding reflection is in Curve.DrawBraid.
To support reflection, I added a variable image_angle.
Now we have 3 angles for one cornrow curve: image_angle, vector_angle and rotate.
  • image angle is the starting angle of the Y image.
  • vector angle is the starting angle of the vector of the Y image.
  • rotate angle is how much the Y image rotates per iteration
2. Add Duplicate
Duplicate takes one parameter: the ID of the original braid. Then it creates a duplicated braid with the next braid ID, which is the size of the braid vector + 1.
The duplicated braid is in the same place with the original one, so to see it, we need to use "Move To" or "Reflect" to move it to somewhere else.


Demo of Reflect and Duplicate


3. Add the following methods:
  • BasicNewBraid which only takes Iteration, X, Y, and Slope
  • Starting Dilate
  • TranslateByPercent
  • Rotate
  • Dilate
Demo of the new methods

Issue to discuss:
In these new methods, I use ID to identify the braid that the user wants to apply the methods on. One reason I use ID is that I saw in Scratch, they have sprite1, sprite2...
But will the concept of ID prevent kids from using Cornrow Curve?

TODO:
  • Colored Braids

Add more parameters to Cornrow Curve

Task: Add more parameters to Cornrow Curve
Date: 0617-0623

1. Add the starting parameters: starting dilation
2. Add the iteration parameters: translate, rotate, dilate
3. Add the functionality of showing the vector of a cornrow curve
All the logic for adding these parameters are in Curve.DrawBraid, Curve.Plait and Curve.DrawVector.

Wednesday, June 16, 2010

June Plan

1. To add the following parameters by the next Wednesday (0623)
1.1 scale or dilate per iteration
1.2 rotate per iteration

2. To have multiple braids by 0630

Make the background of Y transparent

Task: Make the background of Y transparent
Date: 0615-0616

The steps are in the link provided by Eddie:
http://www.fabiovisentin.com/tutorial/GIMP_transparent_image/gimp_how_to_make_transparent_image.asp

The tricky thing is to save the processed image in a transparent capable format, like GIF or PNG.
I tried with jpg for a hour before reading the above link...

Using image for the Y shape

Task: Using image for the Y shape
Date: 0609-0616

1. Study the code for image process in the SB and RW projects
Very helpful!

2. Study JOgl and OpenGL
The difficult things are:
2.1 to rotate the Y, I did it in the same way as Eddie did for rotating the SkateBoarder.
2.2 to make the overlap of the Y shapes look normal
Using the methonds provided by JOgl: glAlphaFunc and glBlendFunc
You can google for more about them.

Reference for JOGL:
JOGL: A Beginner's Guide and Tutorial
Jumping into JOGL
JOGL Userguide
----------------------------------------------------
Reference for OpenGL:
The Red Book
NeHe Productions: OpenGL Lessons
----------------------------------------------------
Working in RGBA Mode

Thursday, June 10, 2010

Deploy the cornrow applet on the CS server

Date: June 10, 2010

I deployed the Cornrow applet on the CS server using 'JNLPAppletLauncher'. According to https://applet-launcher.dev.java.net/, 'JNLPAppletLauncher' allows applets to use extensions like Java 3D, JOGL, and JOAL very easily. So it is what we need.

Steps:
1. Write CCAppletLaunCS.html

2. Replace the generated CC\dist\lib\Core.jar with Core\dist\Core.jar
The first jar is not complete somehow.

3. To satisfy the security requirements, all the jar files need to be signed by the same certificate. 3.1 Generate a key pair
keytool -genkeypair -dname "cn=Ping Wang, ou=CS, o=RPI, c=US" -alias mykey -keypass XXX -storepass XXX -validity 180
3.2 For each jar file (including CC.jar and other referenced jar files)
jarsigner -storepass XXX -keypass XXX jogl.jar mykey

4. Put CC.jar, other required jar files and CCAppletLaunCS.html to /cs/wangp5/public.html/CC

5. You can access the applet at http://www.cs.rpi.edu/~wangp5/CC/CCAppletLaunCS.html
It takes 1~2 minutes loading the applet, a little slow...

More on 'JNLPAppletLauncher'
[1] https://jogl-demos.dev.java.net/applettest.html
[2] https://applet-launcher.dev.java.net/
More on 'JNLP'
[1] http://java.sun.com/developer/technicalArticles/Programming/jnlp/
[2] http://java.sun.com/j2se/1.5.0/docs/guide/javaws/developersguide/syntax.html#resources

Tuesday, June 8, 2010

Deploy the Cornnow applet on my laptop

Task: Put the current version online as an applet
0602-0607

1. Study the deployment of Java applets
Study Material: Lesson: Applets
2. Deploy the Cornnow applet on my laptop

More details:
1. Write CCApplet.html

2. Write CCApplet.jnlp

3. Replace the generated CC\dist\lib\Core.jar with Core\dist\Core.jar
The first jar is not complete somehow.

4. To satisfy the security requirements, all the jar files need to be signed.
4.1 Generate a key pair
keytool -genkeypair -dname "cn=Ping Wang, ou=CS, o=RPI, c=US" -alias mykey -keypass XXX -storepass XXX -validity 180
4.2 For each jar file (including CC.jar and other referenced jar files)
jarsigner -storepass XXX -keypass XXX jogl.jar mykey

5. Deal with native libraries
CC needs 4 dll files: gluegen-rt.dll, jogl.dll, jogl_awt.dll, jogl_cg.dll
Currently, I put them in the bin of the jdk directory; orelse, an error will be reported: java.lang.UnsatisfiedLinkError: no jogl in java.library.path
This solution is not so good, because we may not have access to the bin of the jdk directory on a web server.
I will try to find an alternative way to make the dll files available to the applet.

Tuesday, June 1, 2010

Get familiar with NetBeans IDE

Log for: May 26-June 01

The following materials are good for getting familiar with NetBeans IDE, especially when you need to develop GUI.

NetBeans IDE Quick Start Guide
Developing and Deploying General Java Applications
Introduction to GUI Building
Designing a Swing GUI in NetBeans IDE
Handling Images in a Java GUI Application

To read
Java and JavaFX GUI Application Learning Trail
General Java Development Learning Trail

Start to do the Cornrow project

Log for: May 26 to June 1

1. Setting up the CSDT project on Windows
2. Study the sourcecode of Cornrow

More details:
1. I set up the CSDT project using the code Eddie sent. I also tried to checkout the whole project from the repository, but this didn't work.
The reason is that when I tried to 'Browse for programmableCSDT folder in the repository' as the settingup document says, I couldn't find the programmableCSDT folder. There are just a bunch of subprojects.
Solution: During the meeting last Wednesday, Jason helped us setting up the CSDT project. We can check out the whole project by leaving "Repository Folder" and "Repository Revision" blank.

2. The core logic of Cornrow is in this function: Curve.DrawOval
Inside it, an OpenGL api 'glVertex2d' is invoked to draw the Y shapes.