Java, Swing, OpenGL and Jogl
by nantuko84
Moderators: nantuko84, CCGHQ Admins
Java, Swing, OpenGL and Jogl
by nantuko84 » 24 Sep 2009, 05:29
Have anybody tried OpenGl and Jogl for Java applications?
I played with it few days and what I've seen and what I've made seems very powerfull for me.
I think a lot about moving MagicWars from Swing to Swing+Jogl(OpenGL) that will manage issue with free space on table for cards and will give the possibility to add multiplayer (it's my dream , now I have no idea how to implement multiplayer in 2D shandalar like layout).
Actually the question here is won't it make Java application not cross-platformed? When everything is on Swing, all you need is JRE installed - so just download the game and click .jar, .bat or whatever. Once OpenGL is used, I believe you'll need additional steps that is not so attractive.
So does anybody have any experience with Jogl?
I played with it few days and what I've seen and what I've made seems very powerfull for me.
I think a lot about moving MagicWars from Swing to Swing+Jogl(OpenGL) that will manage issue with free space on table for cards and will give the possibility to add multiplayer (it's my dream , now I have no idea how to implement multiplayer in 2D shandalar like layout).
Actually the question here is won't it make Java application not cross-platformed? When everything is on Swing, all you need is JRE installed - so just download the game and click .jar, .bat or whatever. Once OpenGL is used, I believe you'll need additional steps that is not so attractive.
So does anybody have any experience with Jogl?
Re: Java, Swing, OpenGL and Jogl
by Huggybaby » 24 Sep 2009, 11:24
OpenGL should be supported natively by the drivers of any video card out there AFAIK.
-
Huggybaby - Administrator
- Posts: 3207
- Joined: 15 Jan 2006, 19:44
- Location: Finally out of Atlanta
- Has thanked: 701 times
- Been thanked: 594 times
Re: Java, Swing, OpenGL and Jogl
by Snacko » 24 Sep 2009, 18:07
Jogl depends on some native libraries, but it's easy to set up depending on your system
* Mac OS X:
o libjogl.jnilib
o libjogl_awt.jnilib
o libjogl_cg.jnilib
* Windows:
o jogl.dll
o jogl_awt.dll
o jogl_cg.dll
* Linux:
o libjogl.so
o libjogl_awt.so
o libjogl_cg.so
o libjogl_drihack.so
Re: Java, Swing, OpenGL and Jogl
by nantuko84 » 25 Sep 2009, 05:18
it makes sense that you need different native libraries for every Os, but I don't like the idea that they should be installed separately from applicaiton (most users don't know what opengl is or even have no administrative rights to do that).
well, is it possible NOT to install them instead including all those native libraries into application? Thus, such program will determine OS itself and choose what native library it needs to run using OpenGL.
well, is it possible NOT to install them instead including all those native libraries into application? Thus, such program will determine OS itself and choose what native library it needs to run using OpenGL.
Re: Java, Swing, OpenGL and Jogl
by eugenrivniy » 26 Sep 2009, 10:39
As I read at http://kenai.com/projects/jogl/pages/FAQ, JOGL can use gluegen library to make a dynamic bindings to OpenGL library and you can create portable application without using native libraries.
- eugenrivniy
- Posts: 6
- Joined: 20 Sep 2009, 21:02
- Has thanked: 0 time
- Been thanked: 1 time
Re: Java, Swing, OpenGL and Jogl
by Snacko » 26 Sep 2009, 14:59
You could bundle them all and it will pick up the one needed depending on the system however they are quite big.
Re: Java, Swing, OpenGL and Jogl
by Arch » 29 Sep 2009, 12:45
If you use something like Java Web Start you can make it completely transparent to the user. Web Start can be configured to fetch different dependencies based on what OS the user is using. If I remember correctly you can host it as any regular file as well, no specific server-support needed.
It does have some "problems" though, like certificates.
That's if you are interested in minimizing the download. I don't think bundling all of them would be that much of a problem; most people these days won't notice an extra meg or two.
It does have some "problems" though, like certificates.
That's if you are interested in minimizing the download. I don't think bundling all of them would be that much of a problem; most people these days won't notice an extra meg or two.
Re: Java, Swing, OpenGL and Jogl
by nantuko84 » 30 Sep 2009, 05:07
If I want Web Start to be used, then some changes will be needed to be done in MagicWars as now it doesn't even include images for cards and configuring is done on user side.
Yes, it's probably good option to use it but ... at the moment I can't see big advantages of it.
Anyway thanks for suggestion
Yes, it's probably good option to use it but ... at the moment I can't see big advantages of it.
Anyway thanks for suggestion
Re: Java, Swing, OpenGL and Jogl
by DennisBergkamp » 02 Oct 2009, 19:21
Nantuko,
Wow, this is cool. I've been playing with the same idea, using JOGL (or Java3D, or JME, or whatever) to improve the GUI of MTGForge. It looks like there's definitely a lot of possibilities and power using openGL.
Unfortunately, I haven't really done anything in openGL, do you know a good place to start messing around with this?
Wow, this is cool. I've been playing with the same idea, using JOGL (or Java3D, or JME, or whatever) to improve the GUI of MTGForge. It looks like there's definitely a lot of possibilities and power using openGL.
Unfortunately, I haven't really done anything in openGL, do you know a good place to start messing around with this?
-
DennisBergkamp - AI Programmer
- Posts: 2602
- Joined: 09 Sep 2008, 15:46
- Has thanked: 0 time
- Been thanked: 0 time
Re: Java, Swing, OpenGL and Jogl
by nantuko84 » 03 Oct 2009, 05:17
Yes, it's really cool And I'm impressed by its performance;)
I've made small example with JSplitPane with button on the left and openGL scene on the right with several objects on it that fire events on clicking them.
Unfortunately I'm not so experienced in OpenGL and as usual in such cases examples really helps.
So what can I advise you is to look for openGL examples and projects (open source for sure%)).
What I found was Aerith that is really cool!
and are you planning to use 3D or 2D openGL for MTGForge?
As for me, I'd choose 2D than 3D, at least it's easier to implement for me. But I still think over this.
I've made small example with JSplitPane with button on the left and openGL scene on the right with several objects on it that fire events on clicking them.
Unfortunately I'm not so experienced in OpenGL and as usual in such cases examples really helps.
So what can I advise you is to look for openGL examples and projects (open source for sure%)).
What I found was Aerith that is really cool!
and are you planning to use 3D or 2D openGL for MTGForge?
As for me, I'd choose 2D than 3D, at least it's easier to implement for me. But I still think over this.
Re: Java, Swing, OpenGL and Jogl
by DennisBergkamp » 04 Oct 2009, 20:23
Ah, yes I've been messing with some of the NeHe tutorials. I also downloaded the source of Twinkle (which I think is part of that Aerith program). Very cool stuff
2D seems to suit magic more, but I'm not sure... I'll play around with some more code examples and see what I can learn.
2D seems to suit magic more, but I'm not sure... I'll play around with some more code examples and see what I can learn.
-
DennisBergkamp - AI Programmer
- Posts: 2602
- Joined: 09 Sep 2008, 15:46
- Has thanked: 0 time
- Been thanked: 0 time
Re: Java, Swing, OpenGL and Jogl
by DennisBergkamp » 05 Oct 2009, 01:15
I've been playing around with the Twinkle picture viewer, and I've got it to load images of magic cards. I can't load in too many pics though, because it runs out of memory fairly quickly. I tried setting the heap size in eclipse to 1GB instead of 256 megs, but it didn't seem to do much
-
DennisBergkamp - AI Programmer
- Posts: 2602
- Joined: 09 Sep 2008, 15:46
- Has thanked: 0 time
- Been thanked: 0 time
Re: Java, Swing, OpenGL and Jogl
by Huggybaby » 05 Oct 2009, 02:26
Wow, that's purdy. Keep at it, there are always ways around these memory problems. You'll find out how to do it in one meg eventually!
-
Huggybaby - Administrator
- Posts: 3207
- Joined: 15 Jan 2006, 19:44
- Location: Finally out of Atlanta
- Has thanked: 701 times
- Been thanked: 594 times
Re: Java, Swing, OpenGL and Jogl
by nantuko84 » 05 Oct 2009, 04:42
it looks amazing!)
about outofmemory exception: may be it uses image caching somewhere, I had the similar problem in MagicWars while looking through images in DeckEditor. If it's so, then it can be fixed easily (as far I understand it's open source).
btw, as MTGForge and MagicWars have similar GUI architecture (no matter that they may look different) having hand, table, stack description, input (with yes\no dialog), card image area, may be it will be possible to create configurable OpenGL GUI with some sort of API that then can be easily ported to MTGForge and MagicWars? and they still may look different with the help of skins and plugins.
about outofmemory exception: may be it uses image caching somewhere, I had the similar problem in MagicWars while looking through images in DeckEditor. If it's so, then it can be fixed easily (as far I understand it's open source).
btw, as MTGForge and MagicWars have similar GUI architecture (no matter that they may look different) having hand, table, stack description, input (with yes\no dialog), card image area, may be it will be possible to create configurable OpenGL GUI with some sort of API that then can be easily ported to MTGForge and MagicWars? and they still may look different with the help of skins and plugins.
Re: Java, Swing, OpenGL and Jogl
by Snacko » 05 Oct 2009, 10:35
You need to load / unload textures as you need them and not keep all the 10k pictures in memory at all times (that's what the demo viewer does I presume as It runs out of memory).
In a game of magic you wont see more than ~60 different unique cards (the textures will be shared between the same cards).
In a game of magic you wont see more than ~60 different unique cards (the textures will be shared between the same cards).
18 posts
• Page 1 of 2 • 1, 2
Who is online
Users browsing this forum: No registered users and 5 guests