Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (497)
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]
  ignore  |  Print  
  2D and OpenGL?  (Read 3046 times)
0 Members and 1 Guest are viewing this topic.
Offline fletchergames

Senior Member





« Posted 2009-01-08 21:39:31 »

I only plan to program 2d games.  I will probably never program a 3d game in my entire life.

That said, I've noticed that some of my games have slower performance than I would expect for a 2d game.  It's primarily a problem on computers with Intel GMA graphics, but they're in alot of the computers out there.  For this reason, I considered switching from Java2D to Jogl.  Now that I've skimmed over part of a book that includes information about Jogl, it seems that Jogl is only of any use for 3d games.

Is there any reason for me to explore Jogl or OpenGl at all if I'm only programming 2d games?  I admit that I know essentially nothing about the issue, but it seems like I'm best off sticking with Java2d.  That way, Java will do all the checking about whether it should use DirectX or OpenGl itself.
Offline Matzon

JGO Knight


Medals: 19
Projects: 1


I'm gonna wring your pants!


« Reply #1 - Posted 2009-01-08 21:45:05 »

might want to consider Slick: http://slick.cokeandcode.com/index.php - 2d library on top of opengl, by kevglass

Offline fletchergames

Senior Member





« Reply #2 - Posted 2009-01-08 22:11:29 »

That's an option I might consider, but I had been hoping to work with OpenGl directly, rather than through a library.

Then again, I might be better off with Slick, given that I know essentially nothing about OpenGl.

Does Slick typically get better performance than Java2D?  And what happens when you use Slick on a computer that doesn't have OpenGl?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline quixote_arg

Junior Member


Projects: 1


Jengibre


« Reply #3 - Posted 2009-01-08 22:17:28 »

but I had been hoping to work with OpenGl directly, rather than through a library.

then go with LWJGL
Offline Addictman

Senior Member


Medals: 3
Projects: 1


Java games rock!


« Reply #4 - Posted 2009-01-08 22:47:00 »

Flethcer, JOGL works just as well for 2D as it does for 3D. And yes, you'll probably get alot better performance than with Java2D. If you want to work with OpenGL directly, JOGL basically only provides opengl bindings, so you can't be more direct than that.

Offline bjgil2

Senior Newbie




That's it Mr. Giraffe, get all the marmalade


« Reply #5 - Posted 2009-01-09 02:02:30 »

Another vote here for Slick.  Kev did (does) a great job with it.  Plenty of 2D graphics related stuff already built in, and access to OpenGL when you need it.

Cheers,
Brett
Offline kevglass

JGO Kernel


Medals: 164
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #6 - Posted 2009-01-09 08:40:08 »

Things to note:

a) LWJGL vs JOGL - they're identical as far as 2D graphics in OpenGL are concerned
b) If you're interested in learning or doing something crazy between 2D and 3D it's better to go straight to LWJGL
c) Slick is intentionally designed to let you use whichever bits suit your needs and revert back to OpenGL whenever/wherever you feel the need.

Having seen your previous posts, and guaging your ability based on that, I'm sure you could have yourself up a suitable 2D rendering engine in a few days in OpenGL.

It is worth remembering (I'm sure you know, but for others that might not) that jumping to any sort of native dependency gives you distribution headaches at the moment.

Kev

Offline SacredFenix

Senior Newbie





« Reply #7 - Posted 2009-01-09 19:55:03 »

b) If you're interested in learning or doing something crazy between 2D and 3D it's better to go straight to LWJGL

Why is LWJGL better than JOGL in this case? I have yet to see any significant between them in almost every aspect.
Offline princec

JGO Kernel


Medals: 378
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #8 - Posted 2009-01-09 20:14:45 »

It's somewhat easier to set up and make something appear. Well, last time I looked it was.

Cas Smiley

Offline kevglass

JGO Kernel


Medals: 164
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #9 - Posted 2009-01-09 21:16:18 »

Quote
Why is LWJGL better than JOGL in this case? I have yet to see any significant between them in almost every aspect.

Sorry, there is no difference, I meant rather than going to Slick.

Kev

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline CommanderKeith
« Reply #10 - Posted 2009-01-10 03:30:47 »

I only plan to program 2d games.  I will probably never program a 3d game in my entire life.

That said, I've noticed that some of my games have slower performance than I would expect for a 2d game.  It's primarily a problem on computers with Intel GMA graphics

I'm also a 2d man, and yeah the darned intel graphics cards are everywhere.

As far as I know, java2D's OpenGL pipeline can be used on any computer, even on intel cards (but it may not work since intel cards and their OGL drivers are very bad). You just have to specify the VM flag (-Dsun.java2d.opengl=True).
The D3D pipeline won't work since it's disabled for intel cards due to bad drivers.
The software pipeline always works and on modern computers with big processors, it's very fast.


Offline gouessej
« Reply #11 - Posted 2009-01-12 11:58:44 »

Why is LWJGL better than JOGL in this case? I have yet to see any significant between them in almost every aspect.
If you target mobile phones one day, you might be interested in JOGL 2.0; otherwise, LWJGL and JOGL (Sun's endorsed official OpenGL binding) are almost the same in your case.

Offline fletchergames

Senior Member





« Reply #12 - Posted 2009-01-12 23:49:36 »

It sounds like JOGL is just what I need.  It sounds like it should be relatively easy to figure out how to use for 2d graphics.  Since I don't need to do any 3d graphics at this time, there shouldn't be much of a problem.

Before reading the replies to this thread, I wasn't sure exactly whether JOGL provided any benefits for 2d games or even if it could be used.  The ebook I purchased didn't include the information I thought it would.  It seems to exclusively cover 3d games, while I assumed it would include information about using JOGL for 2d games at the very beginning.

I will try make it possible to switch my program back and forth between using JOGL and Java2D so that I can compare performance.  In the worst case scenario, I'll just switch back to Java2D.
Offline gouessej
« Reply #13 - Posted 2009-01-13 08:48:58 »

I will try make it possible to switch my program back and forth between using JOGL and Java2D so that I can compare performance.  In the worst case scenario, I'll just switch back to Java2D.
If you are disappointed with the performance, maybe you will try to find what is wrong rather than switching back to Java2D.

However, Slick is more than an OpenGL binding, it might be useful in order to avoid reinventing the wheel, it contains some nice features (fonts, tiles, gradients, SVG...) and a quite good documentation (a wiki translated into my mother tongue, thanks Cheesy). It could be interesting to have an equivalent of Slick that would rely on JOGL for those who want absolutely to use JOGL instead of LWJGL and use such a good library.

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.

BurntPizza (21 views)
2014-09-19 03:14:18

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

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

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

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

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

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

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

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

Longarmx (36 views)
2014-09-07 01:10:19
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!