Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (120)
games submitted by our members
Games in WIP (577)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Switch from JOGL to LWJGL  (Read 4460 times)
0 Members and 1 Guest are viewing this topic.
Offline Mike

JGO Wizard


Medals: 86
Projects: 1
Exp: 6 years


Java guru wanabee


« Posted 2009-05-17 14:01:45 »

Hi all,

I am programming an applet/JOGL game and since in my opinion SUN doesn't seem to prioratize it anymore (the applet launcher has had its certificate expired for two weeks now without anyone fixing it) i was going to look into a switch to LWJGL. I spent something like 500 hours on it and I've still got something like 1000 hours to go before I have it in a beta stage.

I'm not using any of the JOGL class structure but only the direct opengl calls, is this a 1:1 map to LWJGL or will I need to spend alot of time changing the structure? What about the animator and glcanvas, does it work exactly the same in LWJGL? I read that applets for with LWJGL, is it a big change from the applet launcher?

I'm sure I could find the answer if I spent a an hour looking through the forum but I hope someone can write a "it's easy" or "it will take you some time".

My current game, Minecraft meets Farmville and goes online Smiley
State of Fortune | Discussion thread @ JGO
Offline kappa
« League of Dukes »

JGO Kernel


Medals: 78
Projects: 15


★★★★★


« Reply #1 - Posted 2009-05-17 14:23:39 »

LWJGL works slightly differently on some of the basic stuff like setting up windows and getting input for the mouse and keyboard but other than that the OpenGL calls stuff is pretty much the same.

LWJGL as an applet works differently from JOGL as an applet but once you get how it works it shouldn't be too much work to transform a LWJGL application into an applet.

I'd spend some time looking at some of the source examples on the LWJGL site.

A pretty good place to get some quick answers to specific questions is LWJGL's irc channel found on freenode at #lwjgl
Offline Mike

JGO Wizard


Medals: 86
Projects: 1
Exp: 6 years


Java guru wanabee


« Reply #2 - Posted 2009-05-17 14:32:38 »

LWJGL works slightly differently on some of the basic stuff like setting up windows and getting input for the mouse and keyboard but other than that the OpenGL calls stuff is pretty much the same.

I am currently using the standard java mouse/keyboard listeners, doesn't that work in LWJGL? Do I need to use JInput?

My current game, Minecraft meets Farmville and goes online Smiley
State of Fortune | Discussion thread @ JGO
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline kappa
« League of Dukes »

JGO Kernel


Medals: 78
Projects: 15


★★★★★


« Reply #3 - Posted 2009-05-17 14:44:58 »

no you won't need JInput, LWJGL's has its own Mouse and Keyboard classes.
Offline Mike

JGO Wizard


Medals: 86
Projects: 1
Exp: 6 years


Java guru wanabee


« Reply #4 - Posted 2009-05-17 14:51:17 »

Okidoki, I found the applet demo on the lwjgl page and am currently looking into what I need to do to move away from JOGL.

Thanks for the help Smiley

I'll write an update here once I'm done with how long it took and if there are any performance differences.

EDIT:
LWJGL is more consistent on using float instead of JOGL that accepts both float and doubles. It will take some rewriting...

My current game, Minecraft meets Farmville and goes online Smiley
State of Fortune | Discussion thread @ JGO
Offline Mike

JGO Wizard


Medals: 86
Projects: 1
Exp: 6 years


Java guru wanabee


« Reply #5 - Posted 2009-05-18 07:35:08 »

One class to go but that one is also the trickiest one.

If you've used overlay extensively in jogl then the migration isn't that easy seeing as lwjgl doesn't have anything like that unless you use a 3rd party library or do some extensive coding yourself.

My current game, Minecraft meets Farmville and goes online Smiley
State of Fortune | Discussion thread @ JGO
Offline Mike

JGO Wizard


Medals: 86
Projects: 1
Exp: 6 years


Java guru wanabee


« Reply #6 - Posted 2009-05-18 14:26:23 »

Sorry for answering my own thread but here it goes:

It took me about 15 hours to migrate from JOGL to LWJGL not counting the Overlay. The Overlay will probably take another 10 or so hours but I'll make sure everything else runs flawless before undertaking that.

Info about my project so you can guess how long it would take for you:
500 hours spent (well it's my first big java project and my first opengl project so that doesn't say too much Smiley)
30 classes
About 10000 lines of code

Things that takes some time that you might not realize if you do the same I just did:
Input (mouse and keybord) takes quite some time to migrate as it works totally different compared to JOGL
OpenGL function calls, LWJGL likes buffers instead of arrays so you'll have to redo alot of your functions
Class structure, if you're going to make an applet you'll have to rethink your structure totally as it doesn't work the same at all
Float consistency, LWJGL loves floats. In fact it loves floats so much that you'll have to adjust all of your calls that used int/double before
Applet Launcher, again only for people doing applets, it is a whole lot better than the JOGL one, you can customize it to look as you want it
Overlay, LWJGL doesn't have an overlay class so you'll have to either create your own version of it or grab a 3rd party one
GL/GLU, you don't have to pass these around everywhere as everything is static, just make sure you have it active in your current thread and you're good to go, it will take some editing though
If you can't find a specific function inside any GL version google it, some are hiding for example inside EXTFramebufferObject
Changing some things like checking current GL version or setting vsync will take some googling as it uses different function names
Cursors work totally different. You have access to HW cursors (Wohoo) but they take much longer to implement (booo)

All in all it's running on the same FPS (but my game has always been CPU limited so no surprice in that) and except for an ugly black screen for a second before starting up the game (which I hope I can get away) not much changed for the end user.

My current game, Minecraft meets Farmville and goes online Smiley
State of Fortune | Discussion thread @ JGO
Offline Darrin

Junior Duke


Projects: 1



« Reply #7 - Posted 2009-05-18 15:20:18 »

Thanks for the update.  At some point I was planning to go away from Java2D.  I have no idea which to choose....JOGL or LWJGL.  I am writing mostly applets.

That sucks a bit about Floats.

I'm curious about sound.  Does LWJGL provide a good interface for that?  Java seems to have major sound issues?

How about the timer?  I heard it was pretty good even on dual cores.

Was the only reason to go away from Jogl due to the certificate?   


Offline Mike

JGO Wizard


Medals: 86
Projects: 1
Exp: 6 years


Java guru wanabee


« Reply #8 - Posted 2009-05-18 15:38:29 »

Thanks for the update.  At some point I was planning to go away from Java2D.  I have no idea which to choose....JOGL or LWJGL.  I am writing mostly applets.

That sucks a bit about Floats.

I'm curious about sound.  Does LWJGL provide a good interface for that?  Java seems to have major sound issues?

How about the timer?  I heard it was pretty good even on dual cores.

Was the only reason to go away from Jogl due to the certificate?   



I'm only using midi sounds so I don't really know, but seeing as LWJGL comes with OpenAL I'm sure it's great.

The main reason was that even though one specific person on this forum keeps saying that JOGL isn't dead it is difficult to believe that anyone is working on it when not even the certificates are in order for weeks. I believe that if anything goes wrong with my game and I need quick help I will be better off with LWJGL (even though I like the name of JOGL better Wink).

Also, the applet loader of JOGL didn't always work and DzzD for example couldn't play my game because it started all the threads twice or even three times.

All is fine in Eclipse but I have an issue with this applet loader as well but I'll create a new thread for that Smiley

My current game, Minecraft meets Farmville and goes online Smiley
State of Fortune | Discussion thread @ JGO
Offline Orangy Tang

JGO Kernel


Medals: 56
Projects: 11


Monkey for a head


« Reply #9 - Posted 2009-05-18 15:40:24 »

All consumer graphics cards handle everything as floats internally anyway, so there's no point using the double version of gl calls since you're just wasting bandwidth. IIRC the double variants are possibly going to be marked as deprecated in the next version of GL anway.

Similarly with array versions - internally jogl is just copying them into buffers so you're just adding unnessesary overhead.

Darrin: Slick utils has a very easy to use api for sound and music playback on top of LWJGL which you should probably take a look at.

[ TriangularPixels.com - Play Growth Spurt, Rescue Squad and Snowman Village ] [ Rebirth - game resource library ]
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Mike

JGO Wizard


Medals: 86
Projects: 1
Exp: 6 years


Java guru wanabee


« Reply #10 - Posted 2009-05-23 12:08:37 »

I've done some bug fixing too but I now have an overlay class that takes the same function calls as the JOGL one and works fine. I also have mouse cursors and everytihn is as it used to be (except for one silly bug/design flaw but I hope I'll get some help with that on lwjgl.org).

In total it took about 30 hours due to the cursors not wanting to work right away and the issue with the applet loader discussed in the other thread.

My current game, Minecraft meets Farmville and goes online Smiley
State of Fortune | Discussion thread @ JGO
Offline gouessej
« Reply #11 - Posted 2009-06-28 16:08:35 »

The main reason was that even though one specific person on this forum keeps saying that JOGL isn't dead it is difficult to believe that anyone is working on it when not even the certificates are in order for weeks.
The certificate has been updated, it is no more an excuse, JOGL 2 is coming soon. If your game does not work on my machine, I assume you won't go back to JOGL, you're not honest. Sorry for this short "off topic".

Offline Mike

JGO Wizard


Medals: 86
Projects: 1
Exp: 6 years


Java guru wanabee


« Reply #12 - Posted 2009-06-28 22:14:12 »

The certificate has been updated, it is no more an excuse, JOGL 2 is coming soon. If your game does not work on my machine, I assume you won't go back to JOGL, you're not honest. Sorry for this short "off topic".

And there we go...

My current game, Minecraft meets Farmville and goes online Smiley
State of Fortune | Discussion thread @ JGO
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Longarmx (52 views)
2014-10-17 03:59:02

Norakomi (43 views)
2014-10-16 15:22:06

Norakomi (33 views)
2014-10-16 15:20:20

lcass (37 views)
2014-10-15 16:18:58

TehJavaDev (68 views)
2014-10-14 00:39:48

TehJavaDev (67 views)
2014-10-14 00:35:47

TehJavaDev (60 views)
2014-10-14 00:32:37

BurntPizza (73 views)
2014-10-11 23:24:42

BurntPizza (45 views)
2014-10-11 23:10:45

BurntPizza (86 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!