jgl java gl written in pure java

hi i came across this api, called jgl, u can google it, it is written using pure java, that means build on top of libraries provided with jre by default, nothing extra needed. it has gl calls and glut calls too. i have downloaded the source code which didnt compile at first. fixed it got rid of the warrning that is genarated due to outdated casting problem with jdk1.1.

the api and code is GPL. so we can basically modify it and so on … any one interested in modifying the library to use java2d instead? this could provide good speed.

peace

check out a project called Slick http://slick.cokeandcode.com/
it uses an api similar to java2d but uses real OpenGL for acceleration so its much faster than java2d.

I believe jgl is the opposite of Slick. Slick is meant to be Java2D on top of LWJGL whereas JGL is openGL on top of java graphics, but it uses the graphics stuff from 1.1 doesn’t it? Basically software emulation for OpenGL…

DP

Slick isn’t that - but heh.

Wouldn’t have though JGL would give a speed increased though. Emulating OpenGL in Java 1.1 java.awt.Graphics without the ability to predict usage. Seems like it’d be a really really useful tool but I’d be surprised if it performed better than modern java2d.

Bizarre side note - could we then make the 1.5 Java2D opengl pipeline work on Java 1.1 using JGL :slight_smile:

Kev

Apologies about the Slick comment…

I think his reasoning behind using j2D is to have the benefit of the improved DirectDraw pipeline ? Also, about the JGL/J2D opengl shizzle, wouldn’t that just end being really really really slow? J2D’s OpenGL pipeline calling on JGL which inturn calls on the Java 1.1x pipeline? Your going through 3 pipelines to end up with something to draw (J2D, JGL, then finally Java 1.1 graphics) which is a tad expensive, no?

Unless im missing something :slight_smile:

DP

im not sure about performance hit reagarding an api on top of each other… but im sure u guys heard that java is going open source and GPL. now the standard api that is provided is suppost to run on all platforms in since that u install the jre and it is avaialable…

here is a senario, i use damn small linux to do unix testing of my application, it runs totally from ram and it is only 50 mb, then i install jre and java3D api, everything goes well, but when i run my java3D application it doesnt because i dont have opengl or mesa installed… that is becuase for this system to be small there is a lot of things omitted, it even uses small x server xvisa or somthing like that. but java runs fine because it can use software emulation when hardware accelaration is not there. so by having JGL in here i can still do opengl on linux and windows and any system that has jre for it.

i have tried some of the glut examples in JGL and the performance was ok with softwar emulation. and i think if we can rewrite the drawing parts with java2D then we can gain more performance without having the fliker problem when an api uses gl and the component uses directX or direct 3D … the case of jogl and java3D with swing.

any way … if u download the source code it will not compile , it has errors… i have them fixed so if u want it i can email it to u, i use netbeans 5.5 and jdk1.6 rc 1.

peace

Our good friend Croft made an API called JIGL which would run JOGL code using either the hw-accelerated JOGL API or that API you found jgl.

Check out his original post here: http://www.java-gaming.org/forums/index.php?topic=14911.0, which also links to a project thijs and DzzD did which achieves a similar thing.

And his page & demo is here: http://www.croftsoft.com/library/software/jigl/

This stuff is very interesting. JOGL code that is portable to non-OGL computers is great. I have steered away from using OGL so far since I remember when I first came to these forums and didn’t upgrade my driver only the JGO member AnalogKid’s ‘Last Drop’s’ OGL game ran on my computer, unfortunately most other OGL games just didn’t work.

Keith

yeah i visited the forum and the site, very interesting … i sent email to robin and he said that he is going to add some new features and upload it soon, i dont know how soon. but for me i think that rewriting the drawing parts to use java2D will surely make better performance, because java2D uses opengl pipeline or d3d … and it fits well with swing and awt. and again , supported where java2d api is supported , which i have always seen it supported even if the system was embeded like damn small linux.

im starting to learn opengl and glut, im reading the red book and i have wrote little demo in C, then translate it to java using jgl, there is little incompatibility in a sense that i didnt see my wire frame square in java, all i got is the black canvas :frowning: . but im playing with it…

after i get good handle on this then convert to C++ “piece of cake” then C# using tao api… and as i learn more then i can propebly with the help of others :-\ change the jgl api to use java2D for drawing. ill post code of my java and C/C++ code using and learning opengl if any one wants to see :).

peace

To Bilal and Kev,

Why is the Java2D OGL pipeline always slower than JOGL & LWJGL? If they’re both using OGL, why isn’t Java2D as fast as those other API’s?

PS: Kev, the Slick demos are really something, but I can’t find much info about how it works. Am I missing a page or haven’t you let the cat out of the bag yet?

If you use the OpenGL pipeline of Java2d you are also using “real” OpenGL … what else?!

Do you have any numbers? I epect it to be a bit slower because with JOGL/LWJGL you use OpenGL more “direct” whereas Java2D has to do coordinate tranformations and so on - but it shouldnt differ a lot.
How do you come to that conclusion?

lg Clemens

did u download jgl from robin’s site ?? the one he has up there is jgl2.4 beta 3 i think , and the source code for that doesnt compile under jdk1.6 and i dont know how it compiled under jdk1.1 , he has created objects with wrong name so the compiler cant find definition… any way i fixed that on the copy i got + there will be some casting problems "warrnings " due to using newer and more strict java 1.5 and 1.6…

if u download the source code ull get folder with examples, look at example-app … that has the examples using glut and can be compiled and run as application… oh u might want to look at main methode and change Frame to JFrame and then add a mthode for close operation.

mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

he uses awt , and no closing operation or event handling is provided :slight_smile: .

im still learning this api and i want to write the same program in C/C++ and java “using jgl”…

peace

Check out Woogley’s ‘BeetleMania’ which was first done in Java2D then SLick (LWJGL).

Java2D: http://www.java-gaming.org/forums/index.php?topic=15237.0 (50FPS)

Slick/OGL: http://www.java-gaming.org/forums/index.php?topic=15316.0 (500FPS)

Keith

about java2D being slower than opengl… i doubt that, if its accelarated using opengl or d3d it shouldnt… but again maybe some operations more algorithmitic “bad spelling”, so uses cpu to compute before sending output to GPU… i think if u stick to simple operations like lines, triagle and polygons u wont see much difference, … just my openion.

peace

Re: Slick, too off topic for this thread :slight_smile:

The only reason I can think that LWJGL/JOGL comes as faster is when you get to more game specific things where you can optimise the opengl calls because you have prior knowledge about the domain (the game in question). Otherwise I’d think they’d come out pretty similar when the opengl pipeline works.

Kev

wow, interesting … from 50 using java2D to about 2000 fps in slick using lwjgl… nice. but agian , jgl can be used where hardware accelaration is not supported , and if supported i think java2d can do well, hopefully in the future better pipline and better performance can be achived in java2d

if you’re referring to my BeetleMania game, the java2d version was capped at 50.

ok … i dont know if i mentined i use netbeans 5.5… any way does anyone know of a good uml diagram generator tht i can use with the jgl to extract how classes are inherited and that way i can see things visually with their methods before i surgically modify the code in those methodes :slight_smile:

peace …