We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProcessing DevelopmentLibraries,  Tool Development › new processing renderer proGL finnished
Page Index Toggle Pages: 1
new processing renderer proGL finnished (Read 5232 times)
new processing renderer proGL finnished
Jul 20th, 2006, 12:10am
 
Hi

I finnished my first version of a new processing renderer. With this new renderer I tried to implement as much OPENGL stuff as possible, this makes drawing faster for many applications. Pixeloperations for example like copy and blend are much faster but lightning and blending look a bit different from p3d and PGraphicsGL.

proGL also includes a shape object ProGLShape. ProGLShape uses the OPENGL display list to record drawing calls. Because ProGLGraphics is completely based on OPENGL all drawing calls in your application can be directly recorded to the graphic cards memory. This makes drawing of the recorded shape much faster.

So far proGL comes as an alpha version, I tried to test it as much as possible but there may be bugs. Any comments, improvements or bug reports are highly appreciated.

Give it a try:
http://texone.org/progl/
Re: new processing renderer proGL finnished
Reply #1 - Jul 20th, 2006, 2:38am
 
On MacOSX, on my machine anyway (PPC), I get this error in the console:

"2006-07-19 17:31:18.386 java[18306] PerformSwizzle Error: Class not found"

Then I get this error message on applet crash:

"Exception:  EXC_BAD_ACCESS (0x0001)
Codes:      KERN_PROTECTION_FAILURE (0x0002) at 0x00000ab0

Reading symbols for shared libraries .... done
/Users/steve/18306: No such file or directory.
Attaching to program: `/usr/bin/java', process 18306.
Reading symbols for shared libraries ................................................................................
............................... done
0x9000b268 in mach_msg_trap ()

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00000ab0
[Switching to process 18306 thread 0x17003]
0x92e6608c in glEnable ()
(gdb) "
Re: new processing renderer proGL finnished
Reply #2 - Jul 20th, 2006, 8:17am
 
on my powerbook (g4 / 1.67 / 1gb ram / os-x 10.4.7 / java 1.4.2) running your example crashes the applet all the time:

crash.log:
Code:

...

An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : Bus Error occurred at PC=0x92E6208C
Function=[Unknown.]
Library=/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib

NOTE: We are unable to locate the function name symbol for the error
just occurred. Please refer to release documentation for possible
reason and solutions.


Current Java thread:

at com.sun.opengl.impl.GLImpl.glEnable(Native Method)

at progl.ProGLGraphics.<init>(ProGLGraphics.java:169)

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

at java.lang.reflect.Constructor.newInstance(Constructor.java:274)

at processing.core.PApplet.createGraphics(PApplet.java:987)

at processing.core.PApplet.createGraphics(PApplet.java:941)

at processing.core.PApplet.size(PApplet.java:849)

at processing.core.PApplet.size(PApplet.java:792)

at Temporary_8399_8315.setup(Temporary_8399_8315.java:11)

at processing.core.PApplet.handleDisplay(PApplet.java:1269)

- locked <0x657584c0> (a Temporary_8399_8315)

at processing.core.PGraphics.requestDisplay(PGraphics.java:535)

at processing.core.PApplet.run(PApplet.java:1152)

at java.lang.Thread.run(Thread.java:552)

...


i hope this helps ..

best,
F
Re: new processing renderer proGL finnished
Reply #3 - Jul 20th, 2006, 1:04pm
 
Thanks for the bug report, I haven't tested proGL on a mac so far. It seems that there habe been some OPENGL calls coming to early. I uploaded a new version, hope it fixes the problem, unfortunately I don't have a mac to test.
Re: new processing renderer proGL finnished
Reply #4 - Jul 20th, 2006, 5:45pm
 
Code:

Current Java thread:
at com.sun.opengl.impl.GLImpl.glMatrixMode(Native Method)
at progl.ProGLGraphics.camera(ProGLGraphics.java:1192)
at progl.ProGLGraphics.camera(ProGLGraphics.java:1121)
at progl.ProGLGraphics.resize(ProGLGraphics.java:279)
at progl.ProGLGraphics.<init>(ProGLGraphics.java:185)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at processing.core.PApplet.createGraphics(PApplet.java:987)
at processing.core.PApplet.createGraphics(PApplet.java:941)
at processing.core.PApplet.size(PApplet.java:849)
at processing.core.PApplet.size(PApplet.java:792)
at Temporary_4045_7003.setup(Temporary_4045_7003.java:11)
at processing.core.PApplet.handleDisplay(PApplet.java:1269)
- locked <0x65758510> (a Temporary_4045_7003)
at processing.core.PGraphics.requestDisplay(PGraphics.java:535)
at processing.core.PApplet.run(PApplet.java:1152)
at java.lang.Thread.run(Thread.java:552)


sorry, no. example still crashes.
F
Re: new processing renderer proGL finnished
Reply #5 - Jul 20th, 2006, 8:36pm
 
Okay I uploaded a new version hope it works on macs.
Re: new processing renderer proGL finnished
Reply #6 - Jul 20th, 2006, 10:34pm
 
Still erroring out:

Code:

2006-07-20 13:30:31 -0700

EXC_BAD_ACCESS (0x0001)
KERN_PROTECTION_FAILURE (0x0002) at 0x00000ab0

Thread 13 Crashed:
0 glClearColor + 56
1 Java_com_sun_opengl_impl_GLImpl_glClearColor__FFFF + 64 (icplusplus.c:28)
2 0 + 72856164
3 0 + 72830480
4 0 + 72829616
5 0 + 72829616
6 0 + 72829616
7 0 + 72819044
8 jio_snprintf + 382228
9 jio_snprintf + 381792


and

Code:


Thread 13 Crashed:
0 libGL.dylib
0x92e65f28 glClearColor + 56
1 libjogl.jnilib
0x0a5a9dc4 Java_com_sun_opengl_impl_GLImpl_glClearColor__FFFF + 64 (icplusplus.c:28)
2 <<00000000>>
0x0457b264 0 + 72856164
3 <<00000000>>
0x04574e10 0 + 72830480
4 <<00000000>>
0x04574ab0 0 + 72829616
5 <<00000000>>
0x04574ab0 0 + 72829616
6 <<00000000>>
0x04574ab0 0 + 72829616
7 <<00000000>>
0x04572164 0 + 72819044
8 libclient.dylib
0x9c7df3c8 jio_snprintf + 382228
9 libclient.dylib
0x9c7df214 jio_snprintf + 381792
10 libclient.dylib
0x9c7fb950 JVM_NewInstanceFromConstructor + 4108
11 libclient.dylib
0x9c7faf50 JVM_NewInstanceFromConstructor + 1548
12 libclient.dylib
0x9c7faab4 JVM_NewInstanceFromConstructor + 368
13 <<00000000>>
0x0457b264 0 + 72856164
14 <<00000000>>
0x045749c0 0 + 72829376
15 <<00000000>>
0x045749c0 0 + 72829376
16 <<00000000>>
0x04574d20 0 + 72830240
17 <<00000000>>
0x045749c0 0 + 72829376
18 <<00000000>>
0x045749c0 0 + 72829376
19 <<00000000>>
0x045749c0 0 + 72829376
20 <<00000000>>
0x04574ab0 0 + 72829616
21 <<00000000>>
0x04574ab0 0 + 72829616
22 <<00000000>>
0x04574ab0 0 + 72829616
23 <<00000000>>
0x04574ab0 0 + 72829616
24 <<00000000>>
0x04574ab0 0 + 72829616
25 <<00000000>>
0x04574e10 0 + 72830480
26 <<00000000>>
0x04572164 0 + 72819044
27 libclient.dylib
0x9c7df3c8 jio_snprintf + 382228
28 libclient.dylib
0x9c7df214 jio_snprintf + 381792
29 libclient.dylib
0x9c7ec5c8 JVM_StartThread + 2572
30 libclient.dylib
0x9c7ec4bc JVM_StartThread + 2304
31 libclient.dylib
0x9c7ec44c JVM_StartThread + 2192
32 libclient.dylib
0x9c7ec314 JVM_StartThread + 1880
33 libclient.dylib
0x9c77b88c JNI_CreateJavaVM_Impl + 43984
34 libSystem.B.dylib
0x9002bc28 _pthread_body + 96

Re: new processing renderer proGL finnished
Reply #7 - Jul 27th, 2006, 5:23pm
 
Hi there!!

Fantastic work! Thank you! Tried it with some of my applets and it worked "out of the box".  And I can't wait to try  some pixel stuff now and some orthogonal views, since they might now work aswell.

I just have a few questions:
- Why is the processing.opengl.* still necessary when using your library?  I thought yours would work as a replacement for PGraphicsGL. Is this due to the jogl stuff?

- How can I access to native GL commands? In the same way as  I would do:
Code:
((PGraphicsGL)g).gl.setSwapInterval(1); 



- Do you think beginRecord() endRecord() are the best name for the ProGLShape? I think people might get confused with the other new recording methods in PApplet.

- [to Ben aswell] Are there any plans to make the shape object into the Processing API as something similar to the following?:
Code:

s = beginShape();

...draw commands...

endShape();


I think this is how nodeBox does it. And it would be really good for certain things:
1- We could use this advantage from the proGL library in a transparent way.  Without having to do a:
Code:

if(g.getClassName() == 'proGL')


2- We would then have a PShape object which could be implemented more thoroughly later (surely after 1.0).

3- Libraries like Candy (the new SVG importer) or Geomerative (the TrueType font importer) could use this common PShape object as a container, instead of each having their own different class.

Maybe it's possible to write a simple recorder in the PGraphics class, but this might mean more bugs and time which is not a priority at the moment.  It's not a feature request, I know there are other things to do right now, it's rather just to know if it's in the TODO list somewhere.

Well, anyway, it's just a thought.

Thanks again for the big contribution.
ricard
Re: new processing renderer proGL finnished
Reply #8 - Jul 27th, 2006, 5:51pm
 
By the way, just tried the ortho command and I get a NullPointerException

I had a look at the sourcecode and in progl.ProGLGraphics.ortho() I see some wierd things:

Code:

public void ortho(float left, float right, float bottom, float top, float near, float far){
float x = 2.0f / (right - left);
float y = 2.0f / (top - bottom);
float z = -2.0f / (far - near);

float tx = -(right + left) / (right - left);
float ty = -(top + bottom) / (top - bottom);
float tz = -(far + near) / (far - near);

projection.set(x, 0, 0, tx, 0, y, 0, ty, 0, 0, z, tz, 0, 0, 0, 1);
}


Can't figure out what 'projection' is, can't find it in the class.

I would try this:
Code:

public void ortho(float left, float right, float bottom, float top, float near, float far){
gl.glMatrixMode(GL.GL_PROJECTION); // Select the Projection Matrix
gl.glLoadIdentity(); // Reset The Projection Matrix
gl.glOrtho(left, right, bottom, top, near, far);
gl.glMatrixMode(GL.GL_MODELVIEW); // Select The Modelview Matrix
}


But I'm too lazy to write the compilation command line (is it easy for you to post it? I will take care of the proper classpath for my computer and I would do further tests on this).

Thanks
Re: new processing renderer proGL finnished
Reply #9 - Aug 18th, 2006, 8:11pm
 
A new progl version is online. I got it to work under mac osx and included Ricards ortho implementation. I will rewrite the Shape object as soon as the new Processing version is finnished. The import of opengl.*; is a hack of processing it is interpreted by the antlr parser to load the native libs (if I remember correctly). When you write code in an ide you do not need to import it.
Re: new processing renderer proGL finnished
Reply #10 - Feb 15th, 2007, 2:46am
 
hi.. i just tried proGL and i keep getting this error:


"the method "void endShape()"  cannot replace the accessible final method "void endShape()" declared in type "processing.core.PGraphics".

build21239.tmp/Temporary_1806_6639.java:1:274:1:308: Semantic Error: The method "void endShape();" cannot replace the accessible final method "void endShape();" declared in type "processing.core.PGraphics".


im not much into java but something wrong with declaring that function in progl lib?

thanks in advance
V
Re: new processing renderer proGL finnished
Reply #11 - Mar 25th, 2007, 4:33pm
 
I get the same errors. [I'm on Windows]

Semantic Error: The method "void endShape();" cannot replace the accessible final method "void endShape();" declared in type "processing.core.PGraphics".

Semantic Error: No accessible method with signature "beginRecord()" was found in type "progl.ProGLShape".

Semantic Error: No accessible method with signature "endRecord()" was found in type "progl.ProGLShape".
Page Index Toggle Pages: 1