Friday, July 7, 2017

Install NetBeans and configure for run Java OpenGL

This is dead easy.

1)Install NetBeans and in it create a project.
2)Download these Jars(assuming you  are using windows).
3) On the library folder right click and click add Jar/folder in the popup menu.
4) Add gluegen-rt.jar and jogl-all.jar files to the library.

There you go you can run jogl programs in this project. Only thing is you need to do this for every project.

Install eclipse and configure it for Java OpenGL

When I was born, I knew nothing - anonymous

JRE library is required to run Eclipse so install JRE latest version.
·         Download a JogAmp library
If you haven't done so already, download and extract the JogAmp library you want to use.
For example, to download and extract JOGL, see the following instructions
1) Go to the site http://jogamp.org/deployment/jogamp-current/archive/jogamp-all-platforms.7z and download should automatically start. The zipped archive is about 54MB. If you are short of data balance, better to get the library (zipped file) from a friend.
2) Unzip the .7z file which is a zipped(compressed) file.
3) Only two jar files are all that is needed from this archive. They are glugen-rt.jar and jogl-all.jar.
4) If you are only working in windows download only these four jar files from my gdrive
·         Eclipse IDE project
Probably the simplest way to use JOGL in an Eclipse project is to create another Eclipse project to contain the JOGL JARs, then make your project depend on this new JOGL project. In the example below, I include only the 64-bit Windows native JARs, but you can put native JARs for as many platforms as you wish together into the JOGL Eclipse project.

1) Create a JOGL project

Put all the JOGL code JARs, native JARs for all platforms you wish to support, and source ZIP files in a directory called "JOGL" in your workspace directory.
Click "File > New > Java Project". Type "JOGL" as the project name and click "Next".


2) Click next and in the next page go to the tab libraries.
Click on add external jars. Then navigate to the folder where you have extracted the zip file in the previous step. In the jogamp-all-platforms folder go to the jar folder and add the jar files glugen-rt.jar and jogl-all.jar.


 3) Expand the jogl-all and gluegen-rt JARs. For each of them, double-click "Source attachment", click "Workspace...", navigate to the corresponding *-java-src.zip file in the project, select it, click "OK", and click "OK" again to dismiss the "Source Attachment Configuration" dialog. The JARs should look like this when you're done:

4) Click the "Order and Export" tab. Check both JOGL JARs, then click "Finish".

­
5) Create another java project and add dependency on the JOGL project

    Create another project, give a name and select next.  or if you have an existing project then
    Right-click your project and click "Properties".
    Select the "Java Build Path" on the left, then click the "Projects" tab on the right.
    Click the "Add..." button, check "JOGL", and click "OK".
    Your dependent project should look like this. Click "OK" to dismiss the "Properties" dialog.




That's it! Your project can now use the library.

Tuesday, July 4, 2017

Tetris in Java OpenGL

The tetris C code has now been ported to Java OpenGL. I did the porting in two sittings of two hours each. It involved quite a lot of changes and I emerged victorious. There was one nagging runtime ArrayIndexOutOfBoundsException which caused a lot of testing time to be wasted.

Here is the code.

Snapshot:

Tuesday, April 11, 2017

Fractal Tree-3D in C#

Following snapshots were obtained in visual studio 2013 using c# and OpenGL.




I rotated the scene and got different views of the tree.

Here is the source.

Sunday, March 5, 2017

Fractal Tree in C++ using OpenGL

A 2D fractal tree using code in the site rosettacode.org in openGL. I am intending to modify the program to make it a 3D tree.

Here is the SnapShot:(Actually the tree drawn is upside down)


Here is the code.

Sunday, January 15, 2017

Points in 3D with gaussian Distribution

Snapshot:


In JOGL this is so easy that I was amazed. Im Trying to generate blobby objects. In the hearn and baker text book its mentioned that points in a gaussian distribution with a surface where the density of the points falls below a threshold is rendered. Will keep updated everyone if this does result in a blobby object.
This piece of code does the magic:

                GL2 gl = arg0.getGL().getGL2();
for(int i=0;i<MAX_RAND;i++)
{
x[i]=1-randomno.nextGaussian()*2;
y[i]=1-randomno.nextGaussian()*2;
z[i]=1-randomno.nextGaussian()*2;
}
gl.glBegin(GL2.GL_POINTS);
for(int i=0;i<MAX_RAND;i++)
{

gl.glVertex3d(x[i],y[i],z[i]);

}
gl.glEnd();

Thanks!