Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (495)
Games in Android Showcase (114)
games submitted by our members
Games in WIP (563)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1] 2 3
  ignore  |  Print  
  JOGL vs LWJGL and the best way to start learning  (Read 15753 times)
0 Members and 1 Guest are viewing this topic.
Offline Huw

Senior Member


Medals: 1
Projects: 2



« Posted 2012-10-15 19:16:03 »

Hi, I'm still relatively new to java and game programming, but I've noticed a lot of people using openGL for their games, so I thought I would try and learn how to use it. Searching around a bit, I found that the two main java opengl libraries(if that's the correct term) are JOGL and LWJGL. Most posts I've seen on which is best to use says it's on personal preference, so which do you much more experienced game developers and programmers think is better/most user friendly for someone like me who isn't very experienced in programming?
Also, where would be the best place to start learning how to use openGL in java, as I couldn't seem to find many up to date tutorials out there, most were for C/C++.

Also a final question, is there anything other than OpenGL that you would recommend I learn/try due to my programming knowledge/ability?

I'm a java noob, but I'm learning. My little blog. My Games.
Offline princec

JGO Kernel


Medals: 378
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #1 - Posted 2012-10-15 19:32:55 »

gouessej will be along in a bit to espouse the virtues of JOGL.

Everyone else uses LWJGL.

Tutorials written in C++ are almost trivial to port to LWJGL as the APIs are very, very similar, apart from the use of Buffers where C/C++ use pointers, types, and length arguments (a Buffer implies all of type, pointer, and length of data already).

Cas Smiley

Offline pixelapp

Junior Member




Pixelapp


« Reply #2 - Posted 2012-10-15 19:36:36 »

There are plenty of up to date JOGL tutorials:

http://www3.ntu.edu.sg/home/ehchua/programming/opengl/JOGL2.0.html

Cloud games and fun.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Huw

Senior Member


Medals: 1
Projects: 2



« Reply #3 - Posted 2012-10-15 19:43:55 »

Thanks, so if I learn opengl in C++, then I can easily transfer into java. I'm going to start here: http://www.arcsynthesis.org/gltut/

EDIT: is there an easy way to change C++ code to java, or is it just done manually, changing the line of code here and there?

I'm a java noob, but I'm learning. My little blog. My Games.
Offline princec

JGO Kernel


Medals: 378
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #4 - Posted 2012-10-15 20:36:09 »

EDIT: is there an easy way to change C++ code to java, or is it just done manually, changing the line of code here and there?
More or less, yes.

Cas Smiley

Offline ra4king

JGO Kernel


Medals: 345
Projects: 3
Exp: 5 years


I'm the King!


« Reply #5 - Posted 2012-10-16 01:34:51 »

Thanks, so if I learn opengl in C++, then I can easily transfer into java. I'm going to start here: http://www.arcsynthesis.org/gltut/

EDIT: is there an easy way to change C++ code to java, or is it just done manually, changing the line of code here and there?
It's very possible for you to turn the OpenGL to Java code yourself.
However, since those tutorials get complicated very quickly, it's best to not waste your time with doing it yourself.
Here are the Java ports of those tutorials.

Offline Huw

Senior Member


Medals: 1
Projects: 2



« Reply #6 - Posted 2012-10-16 06:12:05 »

It's very possible for you to turn the OpenGL to Java code yourself.
However, since those tutorials get complicated very quickly, it's best to not waste your time with doing it yourself.
Here are the Java ports of those tutorials.

Wow thankyou, this will save me tonnes of time!

+1

EDIT: decided to not learn opengl right now, it seems a bit too advanced for my Java level. I'm going to keep developing in 2D so I can increase my abilities in java and be more adept for when I choose to move onto 3D/opengl. Thanks all for the help though, I hope others may have somehow found this useful too.

I'm a java noob, but I'm learning. My little blog. My Games.
Offline princec

JGO Kernel


Medals: 378
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #7 - Posted 2012-10-16 08:05:23 »

Actually using OpenGL for 2D is rather easy - I'd actually say it was easier than using Java2D.

Cas Smiley

Offline Huw

Senior Member


Medals: 1
Projects: 2



« Reply #8 - Posted 2012-10-16 14:44:50 »

Actually using OpenGL for 2D is rather easy - I'd actually say it was easier than using Java2D.

Cas Smiley

Ooh okay, would I follow different tutorials specifically for 2D or just normal ones and ignore the 3d parts?

I'm a java noob, but I'm learning. My little blog. My Games.
Offline princec

JGO Kernel


Medals: 378
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #9 - Posted 2012-10-16 15:01:36 »

There are probably some good 2D-specific tutorials out there for it.

Generally speaking you will need to learn:

1. How to set up the display for 2D (relevant commands: glMatrixMode, glLoadIdentity, glOrtho)
2. How to do a "main loop" (read input, do logic, clear screen, render things, sync and update) and close the app when someone closes it (classes: Display, Keyboard, Mouse; API glClear)
3. How to load a graphic and get it into OpenGL (glTexture2D, glBindTexture)
4. How to draw a sprite (glEnable, GL_TEXTURE_2D, glBegin/glEnd, GL_QUADS, glVertex2f, glTexCoord2f)
5. How to draw sprites transparently (glBlendFunc, GL_BLEND, GL_ONE, GL_SRC_ALPHA)
6. How to draw sprites additively

Come back when you get stuck. Work out those things one at a time.

Cas Smiley

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Huw

Senior Member


Medals: 1
Projects: 2



« Reply #10 - Posted 2012-10-16 15:18:21 »

There are probably some good 2D-specific tutorials out there for it.

Generally speaking you will need to learn:

1. How to set up the display for 2D (relevant commands: glMatrixMode, glLoadIdentity, glOrtho)
2. How to do a "main loop" (read input, do logic, clear screen, render things, sync and update) and close the app when someone closes it (classes: Display, Keyboard, Mouse; API glClear)
3. How to load a graphic and get it into OpenGL (glTexture2D, glBindTexture)
4. How to draw a sprite (glEnable, GL_TEXTURE_2D, glBegin/glEnd, GL_QUADS, glVertex2f, glTexCoord2f)
5. How to draw sprites transparently (glBlendFunc, GL_BLEND, GL_ONE, GL_SRC_ALPHA)
6. How to draw sprites additively

Come back when you get stuck. Work out those things one at a time.

Cas Smiley

Okay, I'll start searching when I have some time to sit down and properly start learning some stuff. I'm busy with lots of school stuff at the moment though, so I have hardly any spare time  Sad Thanks for all the help Cas!

EDIT: So far I've learnt a bit on both 1 and 2, hopefully should be able to start writing my own basic game using lwjgl soon!

I'm a java noob, but I'm learning. My little blog. My Games.
Offline gouessej
« Reply #11 - Posted 2012-11-01 07:43:51 »

gouessej will be along in a bit to espouse the virtues of JOGL.

Everyone else uses LWJGL.
I would just have written that:
"gouessej, xerxes, sven, tons of universities, laboratories, state controlled and private corporations, artists and a very few game studios use JOGL.

Everyone else uses LWJGL."

princec, stop claiming I'm alone to use JOGL, it is simply a lie. The FUD campaigns against JogAmp have to come to an end.

We have a nice wiki with some tutorials.

EDIT: So far I've learnt a bit on both 1 and 2, hopefully should be able to start writing my own basic game using lwjgl soon!
You can still switch to JOGL. princec gave you some nice advises but it doesn't mean that you must use our competitor.

Offline badlogicgames
« Reply #12 - Posted 2012-11-01 10:24:50 »

The "war" over abunch of trivial JNI wrappers for OpenGL/OpenAL is extremely funny to watch for an outsider.

On topic, the steps Cas told you about are a neat way to get into OpenGL. However, once you mastered them, don't get to comfortable. Look into the tutorial on modern OpenGL linked to above, it will allow you to target more platforms, e.g. mobile phones/tablets.

http://www.badlogicgames.com - musings on Android and Java game development
Offline matheus23

JGO Kernel


Medals: 107
Projects: 3


You think about my Avatar right now!


« Reply #13 - Posted 2012-11-01 14:13:36 »

The "war" over abunch of trivial JNI wrappers for OpenGL/OpenAL is extremely funny to watch for an outsider.

I wouldn't call them trivial, since both have really big windowing systems, I think the JogAmp Windowing codebase is even bigger then LWJGL's.
Also, I'd really say that both princec and gouessej are pretty agressive in this war Sad
But everything is okey right now, so thats nothing to worry about Smiley

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline princec

JGO Kernel


Medals: 378
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #14 - Posted 2012-11-01 14:58:40 »

I'm not aggressive about it, I just love winding Julien up.

Cas Smiley

Offline matheus23

JGO Kernel


Medals: 107
Projects: 3


You think about my Avatar right now!


« Reply #15 - Posted 2012-11-01 16:33:14 »

I'm not aggressive about it, I just love winding Julien up.

Haha, so then everything is normal and as always Grin

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline ra4king

JGO Kernel


Medals: 345
Projects: 3
Exp: 5 years


I'm the King!


« Reply #16 - Posted 2012-11-02 22:15:43 »

Popcorn for $1! Popcorn for $1! Get 'em here!

*munches on popcorn*

Offline concerto49

Junior Member





« Reply #17 - Posted 2012-11-03 00:23:22 »

Popcorn for $1! Popcorn for $1! Get 'em here!

*munches on popcorn*

Can I have some thanks?

Votes for LWJGL.

High performance, fast network, affordable price VPS - Cloud Shards
Available in Texas, New York & Los Angeles
Need a VPS Upgrade?
Offline princec

JGO Kernel


Medals: 378
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #18 - Posted 2012-11-03 02:31:42 »

I'm drunk! Where is Julien, I want to mock him.
And what better way than to fork TUER and "port" it to LWJGL, pointlessly!
Fetch me Eclipse and some whisky.

Cas Smiley

Offline sproingie

JGO Kernel


Medals: 202



« Reply #19 - Posted 2012-11-03 02:33:49 »

JOGL's improved a lot, and the speed differences are negligible now.  JOGL's got better native window support with multiple windows, and it has some interesting utility classes for things like animation (that probably don't belong in there).  The use of a graphics context object similar to how AWT/Java2D works does allow at least in theory for overrides (it'd probably take a lot of source hacking)

But JOGL's packaging is rubbish.  The release engineering is just bizarre (better now I'm told) and there's no artifacts on maven central so I can't easily work it in to any of my projects.  So when the functionality I actually care about is otherwise equal, I'm going to go for convenience every time, and right now the winner is LWJGL.
Offline sproingie

JGO Kernel


Medals: 202



« Reply #20 - Posted 2012-11-03 02:37:51 »

Fetch me Eclipse and some whisky.

I dunno why that reminds me of this.  Word association I guess.

Click to Play

Offline gouessej
« Reply #21 - Posted 2012-11-04 00:53:34 »

And what better way than to fork TUER and "port" it to LWJGL, pointlessly!
I have done my best to ease this task in case someone really needs to do it, especially in the pre-beta version in which almost all references to classes relying on JOGL are done in the main class. It's under GPL v2 after all, feel free to do so; while you respect the license, I won't complain.

there's no artifacts on maven central so I can't easily work it in to any of my projects.
Please stop FUD.
Quote
rc11 packages have been pushed to the staging repositories for Central
Source: http://forum.jogamp.org/Release-v2-0-rc11-tp4026703p4026731.html

Offline sproingie

JGO Kernel


Medals: 202



« Reply #22 - Posted 2012-11-04 04:14:25 »

Good to know.  What's the group/artifact ids?  search.maven.org is still giving me ancient jogl 1.x
Offline gouessej
« Reply #23 - Posted 2012-11-04 10:18:33 »

Good to know.  What's the group/artifact ids?  search.maven.org is still giving me ancient jogl 1.x

There is still something wrong, I'm really sorry, the push takes age to end:
Quote
... but I'm still waiting for the pushed packages to be synced to the Central repository. I'm not sure what's taking so long...
http://forum.jogamp.org/Release-v2-0-rc11-tp4026703p4026755.html

Offline gouessej
« Reply #24 - Posted 2012-11-04 10:35:31 »

And what better way than to fork TUER and "port" it to LWJGL, pointlessly!
You have to replace some classes using the renderer based on JOGL 2.0 by their equivalents based on its competitor in this class:
http://tuer.svn.sourceforge.net/viewvc/tuer/pre_beta/engine/service/Ardor3DGameServiceProvider.java
At first, you have to replace JoglNewtFocusWrapper, JoglNewtKeyboardWrapper, JoglNewtMouseManager and JoglNewtMouseWrapper by their equivalents based on the binding of your choice.

Then, you have to retrieve the width, the height and the bits per pixel without using NEWT which should be trivial.

After that, if you want to port JFPSM too, you will only have to replace com.jogamp.common.nio.Buffers by something else (plain standard Java or an helper coming from the binding you use) which is trivial again.

Finally, you will have to modify the Ant script. I advise you to take as an example an older revision that does not use the automatic extraction and loading of native libraries from JARs as you won't rely on a feature coming from JogAmp. You have to replace all references to GlueGen, JOAL and JOGL resources by their equivalents... When you're ready, you'll be able to use this script to generate all signed JARs and the JNLP files.

Offline nsigma
« Reply #25 - Posted 2012-11-04 11:52:22 »

JOGL's got better native window support with multiple windows,

Yes, LWJGL needs NEWT!  Time for you guys to bury the hatchet, preferably somewhere other than each others' skulls!  Wink

Praxis LIVE - open-source intermedia toolkit and live interactive visual editor
Digital Prisoners - interactive spaces and projections
Offline gouessej
« Reply #26 - Posted 2012-11-04 12:41:35 »

Yes, LWJGL needs NEWT!  Time for you guys to bury the hatchet, preferably somewhere other than each others' skulls!  Wink
You can mix NEWT with the competitor of JOGL or port it, both use similar licenses.

Offline matheus23

JGO Kernel


Medals: 107
Projects: 3


You think about my Avatar right now!


« Reply #27 - Posted 2012-11-04 12:43:48 »

Yes, LWJGL needs NEWT!  Time for you guys to bury the hatchet, preferably somewhere other than each others' skulls!  Wink
You can mix NEWT with the competitor of JOGL or port it, both use similar licenses.
The fun thing would anyways be, that you couldn't be able to use the NEWT multi-window feature because LWJGL is all static. And then it would even make no sense, because when you built the stuff in LWJGL from static to instanced, then you'd have a small part of JogAmp...
If you want NEWT you'd just go with JOGL/JogAmp Grin

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline gouessej
« Reply #28 - Posted 2012-11-04 12:51:01 »

Yes, LWJGL needs NEWT!  Time for you guys to bury the hatchet, preferably somewhere other than each others' skulls!  Wink
You can mix NEWT with the competitor of JOGL or port it, both use similar licenses.
The fun thing would anyways be, that you couldn't be able to use the NEWT multi-window feature because LWJGL is all static. And then it would even make no sense, because when you built the stuff in LWJGL from static to instanced, then you'd have a small part of JogAmp...
If you want NEWT you'd just go with JOGL/JogAmp Grin
As soon as I know, they plan to fix this design flaw in the third version. you're right to point out this aspect. "all static" drives it simple/simplistic which is nice for newbies but it has a cost. JogAmp and its competitor already share some classes, we borrowed some classes (for projections) and they did it too (Java GLU implementation).

Offline gouessej
« Reply #29 - Posted 2012-11-04 19:58:27 »

And what better way than to fork TUER and "port" it to LWJGL, pointlessly!
I have just removed some references to com.jogamp.common.nio.Buffers from JFPSM. I will try to move the mechanism that retrieves the screen size and the bits per pixel into Ardor3D. If you want, I will add an option allowing to restart TUER with the third version of the competitor of JogAmp when it is ready.

Pages: [1] 2 3
  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.

Dwinin (23 views)
2014-09-12 09:08:26

Norakomi (56 views)
2014-09-10 13:57:51

TehJavaDev (69 views)
2014-09-10 06:39:09

Tekkerue (34 views)
2014-09-09 02:24:56

mitcheeb (56 views)
2014-09-08 06:06:29

BurntPizza (40 views)
2014-09-07 01:13:42

Longarmx (25 views)
2014-09-07 01:12:14

Longarmx (31 views)
2014-09-07 01:11:22

Longarmx (31 views)
2014-09-07 01:10:19

mitcheeb (39 views)
2014-09-04 23:08:59
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

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!