instantreality forum
news: Welcome to the instantreality forums!
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
September 03, 2010, 09:36:10 am


Login with username, password and session length


Pages: [1]
  Print  
Author Topic: processing applet as texture  (Read 2645 times)
mzoellner
Administrator
Jr. Member
*****
Posts: 83


View Profile
« on: August 19, 2007, 06:25:18 pm »

 i managed to get processing sketches working as live textures in instant reality (x3d). now it is possible to simply write animated and interactive textures in processing and use them in 3d scenes. this is done by an applet wrapper that renders a processing sketch offline and copies its pixels[] array into an x3d SFImage().
 
here is an example how to load a processing applet as texture in instant player..
 
ProcessingTexture.class is a wrapper class that loads a processing applet and puts its framebuffer into an SFImage. it also sends mouse events from instant player to the applet.
 
in order to load your processing applet you have to follow these steps:
 
- download instant player and install it (http://instantreality.org/downloads)
- download the zip with the wrapper class and the examples and extract it
- write your processing sketch (size in power of two: 256×256, 512×512, 1024×512, ..), export it and copy the jar into the same folder as the example
- open ProcessingTexture.x3d in a text editor
- add your jar file to the “javaClassPath” in the ContextSetup node at the top of the file (windows: separate with ';')
- change the value of the script node’s “name” field to the name of your applet (without .class or .pde)
- open the x3d file in instant player. you should see your applet on a cube
 
download:
http://i.document.m05.de/wp-content/uploads/2007/08/instantprocessing.zi p
 
more:
http://i.document.m05.de/?p=370
Logged
fjen
Jr. Member
**
Posts: 54


View Profile
« Reply #1 on: August 20, 2007, 06:37:13 am »

hi michael, thanks!

i have problems running it on os-x:
- ProcessingTexture.class was compiled with 1.5, i still use 1.4.2 which is Processings official requirement. recompiled that, no problem
- now i'm getting an AWT error saying:
Code:
load PApplet: ProcessingTest
Exception in thread "main" java.lang.InternalError: Can't start the AWT because Java was started on the first thread.  Make sure StartOnFirstThread is not specified in your application's Info.plist or on the command line
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1586)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1503)
at java.lang.Runtime.loadLibrary0(Runtime.java:788)
at java.lang.System.loadLibrary(System.java:834)
at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:50)
at java.security.AccessController.doPrivileged(Native Method)
at sun.awt.NativeLibLoader.loadLibraries(NativeLibLoader.java:38)
at sun.awt.DebugHelper.<clinit>(DebugHelper.java:29)
at java.awt.Component.<clinit>(Component.java:506)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at ProcessingTexture.initialize(ProcessingTexture.java:26)

any ideas?
Logged
mzoellner
Administrator
Jr. Member
*****
Posts: 83


View Profile
« Reply #2 on: August 22, 2007, 05:49:07 pm »

uh, i have no idea. i checked the example on a macbook pro without processing and it worked immediately. but i did not test it with 1.4.2.
Logged
fjen
Jr. Member
**
Posts: 54


View Profile
« Reply #3 on: August 22, 2007, 06:59:54 pm »

here's the error in full length (double clicking the x3d-file to make IP open):

Code:
WARNING Avalon Scene/Scene: Unknown Field: description
WARNING Avalon Script/script.name: Invalid Field dec, "value" invalid for accessType inputOnly
FATAL OpenSG Invalid pixel depth: 0
LOG JAVA Initialized JVM
load PApplet: ProcessingTest
Exception in thread "main" java.lang.InternalError: Can't start the AWT because Java was started on the first thread.  Make sure StartOnFirstThread is not specified in your application's Info.plist or on the command line
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1586)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1503)
at java.lang.Runtime.loadLibrary0(Runtime.java:788)
at java.lang.System.loadLibrary(System.java:834)
at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:50)
at java.security.AccessController.doPrivileged(Native Method)
at sun.awt.NativeLibLoader.loadLibraries(NativeLibLoader.java:38)
at sun.awt.DebugHelper.<clinit>(DebugHelper.java:29)
at java.awt.Component.<clinit>(Component.java:506)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:141)
at ProcessingTexture.initialize(ProcessingTexture.java:26)
LOG OpenSG GL Vendor/Renderer: ATI Technologies Inc./ATI Radeon 9600 XT OpenGL Engine
Exception in thread "main" java.lang.NullPointerException
at ProcessingTexture.processEvent(ProcessingTexture.java:40)
Exception in thread "main" java.lang.NullPointerException
at ProcessingTexture.processEvent(ProcessingTexture.java:40)
[ the last two lines go on forever ]

one line i've seen before with my own remote-processing tests (connecting via BrowserFactory) is:
Code:
FATAL OpenSG Invalid pixel depth: 0

anything else i can provide to track this down?
Logged
pdaehne
Administrator
Full Member
*****
Posts: 244


View Profile
« Reply #4 on: August 29, 2007, 02:32:29 pm »

Hello Florian,

i have problems running it on os-x:
- now i'm getting an AWT error saying:
Code:
Exception in thread "main" java.lang.InternalError: Can't start the AWT because Java was started on the first thread.  Make sure StartOnFirstThread is not specified in your application's Info.plist or on the command line

This is a known bug. Currently you cannot use AWT in Script nodes on Mac OS. I.e. you cannot open windows etc.

Bye,

Patrick
Logged
fjen
Jr. Member
**
Posts: 54


View Profile
« Reply #5 on: August 29, 2007, 03:28:53 pm »

yeah, i kinda guessed it needs a window to use awt. just wanted to let michael know it's not working for me ..
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC