You are not logged in.

OlimilO

Intermediate

  • "OlimilO" is male
  • "OlimilO" started this thread

Posts: 277

Date of registration: Jan 18th 2009

Location: Germany

Occupation: software engineer

  • Send private message

1

Monday, November 16th 2009, 10:45pm

Create fantastic graphics with processing

Hello,

This tutorial is about how to use the processing library. Processing Is a library for easily creating fantastic computer graphics. Exact two years ago on 12. nov. 2007 the computer magazine "c't magazin für computertechnik" published an article about processing. I was really impressed about the pictures In the magazine. Of course you are able to use it In Jabaco too.

Download it from the site processing.org
http://processing.org/download/processing-1.0.9-expert.zip


Unzip it in a folder for example:
C:\program files\processing.org\


just a simple example to explain how to use it in Jabaco:

* Start Jabaco with a new Console Application.
* The console is not needed, so:
-> In the project explorer select the Project-item
-> In the properties-editor Select Startup Console And change it to Window
* In Jabaco click the menu item "Project" -> "References (classpath)..."
* In the dialog click the button "Add Jar-Archive"
* select the library core.jar from the folder processing-1.0.9-expert\lib .
* add a new class to your project and name it "MyApp" In the properties editor select superclass processing/core/PApplet
In the class add the following code:

Jabaco Source

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Option Explicit
Import processing#core
Public Sub setup()
   size(800, 600, P3D)
   fill(204)
End Sub
Public Sub draw()
   lights()
   background(0)
   ' Change height of the camera with mouseY
   '  eyeX, eyeY, eyeZ
   '  centerX, centerY, centerZ
   '  upX, upY, upZ   
   camera(30.0, mouseY, 220.0, _
           0.0,    0.0,   0.0, _
           0.0,    1.0,   0.0)
   ' create a box
   noStroke()
   box(90) 
   stroke(255)
   ' create the 3 coordinate axis
   line(-100, 0, 0, 100, 0, 0) 
   line(0, -100, 0, 0, 100, 0)
   line(0, 0, -100, 0, 0, 100)
End Sub


Module1:

Jabaco Source

1
2
3
4
5
6
7
Public Sub main(ByJava args() As String)
   Dim s() As String
   Redim s(0 To 1)
   s(0) = "--present"
   s(1) = "MyApp" '<-- name of the main class that extends PApplet
   PApplet.main(s)
End Sub


Start the project, you will see a fullscreen black window something like in the picture attached.

You can close it with the stop-button on the bottom left corner.



have fun with Jabaco
OlimilO
OlimilO has attached the following image:
  • Processing1.png

OlimilO

Intermediate

  • "OlimilO" is male
  • "OlimilO" started this thread

Posts: 277

Date of registration: Jan 18th 2009

Location: Germany

Occupation: software engineer

  • Send private message

2

Monday, November 16th 2009, 11:32pm

Examples 3D Form BrickTower

Examples > 3D > Form > BrickTower
OlimilO has attached the following image:
  • BricWall.png
OlimilO has attached the following file:
  • BrickWall.zip (5.34 kB - 579 times downloaded - latest: Mar 21st 2024, 10:30pm)

OlimilO

Intermediate

  • "OlimilO" is male
  • "OlimilO" started this thread

Posts: 277

Date of registration: Jan 18th 2009

Location: Germany

Occupation: software engineer

  • Send private message

3

Monday, November 16th 2009, 11:34pm

Examples 3D Form CubicGrid

Examples > 3D > Form > CubicGrid
OlimilO has attached the following image:
  • CubicGrid.png
OlimilO has attached the following file:
  • CubicGrid.zip (4.49 kB - 584 times downloaded - latest: Mar 21st 2024, 10:47pm)

Manuel

Administrator

  • "Manuel" is male

Posts: 256

Date of registration: Jul 16th 2008

Location: Erlangen, Germany

Occupation: Software Developer

Hobbies: Jabaco, game theory, text-mining

  • Send private message

4

Tuesday, November 17th 2009, 1:46am

really cool.

hari

Beginner

  • "hari" is male

Posts: 8

Date of registration: May 9th 2009

About me: Web developer by trade, and lover of Open Source Movement!

Location: Coimbatore,TamilNadu,India

Occupation: Web Developer

Hobbies: programming,bycycling,chess,drawing

  • Send private message

5

Wednesday, November 18th 2009, 7:55am

wow

looks nice

theuserbl

Intermediate

Posts: 436

Date of registration: Dec 20th 2008

  • Send private message

6

Thursday, November 19th 2009, 6:37pm

Thx.

I can only recommend to try Processing out as it is (without Jabaco for development). Processing comes with its own little IDE and documentation and is completly OpenSource. To develop in it, you don't need to know about modules. It can creating it itself. It is a preprocessor for Java. So it compiles simple Processing-programs to Java-programs. And like Jabaco, you don't need to have a JDK installed. The JRE is enough, because it comes with the Eclipse Compiler for Java (ecj).

And your three programs are very nice showing disadvantages of Jabaco.

If anybody wonder, why OlimilO have written the most code outside of Module1 in a seperated class library: Jabaco compiles one piece of code different, depending on where it stand and so.

For example: All code in a Module will be compiled static. Writing "Public Static Sub main ..." or "Public Sub main ..." is in a Module the same, because the compiler compiles there everything as static.
In a ClassLibrary/ClassModule, on the other side, there is everytime compiled something like "Private Sub initVars()". You haven't written that code, but it is compiled. I think for the events and so existing it. If you create youself a initVars(), Jabaco creates its own with the name "initVars1()" and so on. But this is happen in a class-library, not in a Module.

Possible code in a Form or Dialog or so on, will be again different compiled. So there existing in the horizontal different rules, how the same piece of code will be compiled.

But Jabao compiles in the vertical the code different, too. So there existing m*n different output-code of the same piece of code.

With the vertical I mean the difference between the compile for a start in the GUI and the compile to Jar or Exe. The created binary code is different!
For example, if you have a picture file in your resource, then the on the fly compiler of direct compiling would create something like
new ImageIcon("myPicture.png")
where by compiling it to Jar or Exe, it will be compiled to
new ImageIcon(getClass().getResource("myPicture.png"))
I can not write it in Jabaco, because in Jabaco both are completly the same.
But for Java it is very different. The first one loads normally the picture. But the second one is, if your picture is inside the .jar you have started. If you don't start a .jar there is not much difference to the first one. Thats the only way to access a picture in the own .jar file in Java. Addidional the first one can also be called in a static context, but the second one not!
So it can be possible, that if you want to integrate in a Jabaco-Module (which is everytime static) a Resource, that it works by clicking on "start" ok. But if you compile it to a .jar or .exe, it creates errors.
There are also more differences between the two compile-mechanisms. For example compiles the "to .jar" compilation in every class file a MsgBox call and so on.

And now I come back to OlimilO and Progressing.
All three programs running perfect, if you cklick in the IDE on "start".
But if you compile it to .jar it creates errors.
The first program, shows one error, but runs then later ok.
BrickWall shows after one error the next error and is into .jar compiled form not usable.
CubicGrid shows one error and runs then ok. But the cubes have then all black frames.

To handle one sourcecode so different is very risky.


And additional point of Jabaco, where I think, that it could be risky is the way of importing classes.
To access the MsgBox from Java, you can start it direct with a
VBA.Interaction.MsgBox("My Text");
or by importing VBA and then only writing
Interaction.MsgBox("My Text");

Jabaco on the other way, can also write the long way
VBA#Interaction.MsgBox("My Text")
or additional by importing VBA the very short way
MsgBox("My Text")

Without calling the class, it starts direct the method of the class!
With the Jabaco own classes, there is no problem. But if you import external classes, the import works the same.
Java using the way over the class, because there are too much methods with the same name.
For example toString() exists in very much classes.
So it is possible, that you would like to access the method ABC of the class XYZ, but you accesses the method ABC of the class UVW.
But there I am not realy sure, if it is a big problem.

Greatings
theuserbl

OlimilO

Intermediate

  • "OlimilO" is male
  • "OlimilO" started this thread

Posts: 277

Date of registration: Jan 18th 2009

Location: Germany

Occupation: software engineer

  • Send private message

7

Tuesday, November 24th 2009, 1:25pm

inner classes, a class inside another class

You are welcome, but please ... you should learn something about "java inner classes".

suggestion: http://java.sun.com/docs/books/tutorial/…nerclasses.html

Every class in processing simply is a innerclass o the main PApplet.


As mentioned earlier, Jabaco is not able of making inner classes, but it is because of the VB-Syntax.



suggestion to Manuel:



Property-Editor -> what about making a property for the class:

something like:
Is inside class: "myproject/mypackage/myclass"



Of course the intellisense inside the inner class must show all members of the outer surrounding class.



OlimilO

Rate this thread
WoltLab Burning Board