Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (480)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (547)
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  
  make a Porting: Java2D to JOGL  (Read 1142 times)
0 Members and 1 Guest are viewing this topic.
Offline alesky

Junior Member


Medals: 3
Exp: 15 years


mmm....


« Posted 2013-01-31 16:54:03 »

hi guys

i have a game implemented completely in Java2D,
i would like now study jogl and make a complete porting,

my game is a side scrolling shooter.
it is mainly based on  direct draw of the images using the primitive of java2D --> Graphics2D.drawImage
The engine is provided of functionality to modify color and transparent and rotation of the images,
finally i have final effect over the final image create drawing directly over it that allow my to make effect like darkness (used for example in the transition between the level etc..), send storm, rain etc....

now studding same tutorial of jogl I undestood that is completely based on a 3D concepts.
So to create a flat 2D word i have to:
A) create a 3D word with the  Z coordinate constant and use the Orthographic Projection
B) to print an image create a rectangle/square and load the image as a texture over it

is there another approach "more 2D" that this one, or this is the correct path that i have to follow to reach my target?
thanks guys


 
Offline ra4king

JGO Kernel


Medals: 345
Projects: 2
Exp: 5 years


I'm the King!


« Reply #1 - Posted 2013-01-31 21:31:07 »

That's the correct general gist of it, so you're fine!

Offline Mads

JGO Ninja


Medals: 26
Projects: 3
Exp: 6 years


One for all!


« Reply #2 - Posted 2013-02-01 10:43:45 »

Nope. Orthographic and textures on polygons is where it's at. It's not too hard if you're using immidiate mode to render. That's slower as well, but I can't imagine it being a problem if you're coming from Java2D. Smiley

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

JGO Coder


Medals: 20


Game Engineer


« Reply #3 - Posted 2013-02-01 12:19:55 »

This might get flamed by JOGL lovers, but I would recommend going to LWJGL instead. I used to use JOGL but I always had non-GC pauses in my game and I could never figure out why... I switched to LWJGL and the pauses went away and my FPS was even up to 50% faster.

Offline Mads

JGO Ninja


Medals: 26
Projects: 3
Exp: 6 years


One for all!


« Reply #4 - Posted 2013-02-01 12:34:55 »

This might get flamed by JOGL lovers, but I would recommend going to LWJGL instead. I used to use JOGL but I always had non-GC pauses in my game and I could never figure out why... I switched to LWJGL and the pauses went away and my FPS was even up to 50% faster.

I prefer LWJGL too, but that's personal preference. I don't think we can reach an agreement on this, on JGO, and that's completely fine Smiley

Offline princec

JGO Kernel


Medals: 361
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #5 - Posted 2013-02-01 12:34:59 »

Even I wouldn't take that advice as gospel Smiley LWJGL is rarely more than a few % faster than JOGL, so it was likely you were just doing something slightly wrong with JOGL there.

Cas Smiley

Offline StrideColossus
« Reply #6 - Posted 2013-02-01 12:42:27 »

Nope. Orthographic and textures on polygons is where it's at. It's not too hard if you're using immidiate mode to render. That's slower as well, but I can't imagine it being a problem if you're coming from Java2D. Smiley

I'd recommend using immediate mode initially as well - it's deprecated in favour of more 'modern' techniques using VBOs, shaders, VAOs, etc.  but it is a much simpler learning curve, you can always refactor later if required.

Immediate mode is also considerably slower but I imagine that's less important than getting to grips with OpenGL for you right now.
Offline Mads

JGO Ninja


Medals: 26
Projects: 3
Exp: 6 years


One for all!


« Reply #7 - Posted 2013-02-01 13:18:42 »

Immediate mode is also considerably slower but I imagine that's less important than getting to grips with OpenGL for you right now.

How much, relative to "fancy" methods as well as Java2D? Do we have any charts?

Offline princec

JGO Kernel


Medals: 361
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #8 - Posted 2013-02-01 13:41:05 »

A couple of years ago... I was limited to about 1000-1500 sprites @ 60Hz using immediate mode rendering. Now I can do 25,000. Obviously just ballpark figures but you get the general gist.

You might think that 1000 sprites is a lot but we regularly use a couple of thousand in our games and they "look" quite "simple", no?

Cas Smiley

Offline 20thCenturyBoy

Senior Member


Medals: 3


So much to learn, so little time.


« Reply #9 - Posted 2013-02-01 16:02:53 »

When you say "Immediate Mode" is that like the old NeHe tutorials on gamedev.net? Where you just define your vertices and output them?

"I have never done unit testing and I don’t find it a very useful concept" - Jonathan Blow
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline StrideColossus
« Reply #10 - Posted 2013-02-01 16:08:49 »

When you say "Immediate Mode" is that like the old NeHe tutorials on gamedev.net? Where you just define your vertices and output them?

Yes.

i.e. methods such as glBegin/End, glVertex, glNormal, glColor, etc.
Offline 20thCenturyBoy

Senior Member


Medals: 3


So much to learn, so little time.


« Reply #11 - Posted 2013-02-01 16:13:03 »


i.e. methods such as glBegin/End, glVertex, glNormal, glColor, etc.


Ah the old Redbook OpenGL 1.1 style?

Is it really worth learning that stuff only to have to discard it when using "modern" shader techniques?

"I have never done unit testing and I don’t find it a very useful concept" - Jonathan Blow
Offline princec

JGO Kernel


Medals: 361
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #12 - Posted 2013-02-01 16:36:27 »

Yes. Because it's easy and it works with fewer of those "my screen is just black" moments.

Cas Smiley

Offline StrideColossus
« Reply #13 - Posted 2013-02-01 16:50:07 »

Quote

Ah the old Redbook OpenGL 1.1 style?

Is it really worth learning that stuff only to have to discard it when using "modern" shader techniques?

I would suggest yes it's definitely still worth it.  Getting something up and running with the older APIs is much quicker and easier - most of hard work is done for you (e.g. gluLookAt to set up your projection, matrix management, etc) meaning you can focus on your particular game or application until you're comfortable with OpenGL.  Once you've reached that point then I suggest you have a look at re-implementing using vertex and index buffers, VAOs, shaders/GLSL, etc. because (trust me) there's a lot of stuff to get to grips with - even just to get your texture-on-a-quad Wink - and you won't have 'wasted' much (if any) effort should you decide to switch to the non-deprecated (i.e. core profile) API.

However I'm thinking from the perspective of someone who's implementing an OpenGL app from the 'ground up' (which is my personal interest), as an alternative you might want to investigate using a higher-level library/engine such as libgdx* which builds on top of an OpenGL library (such as LWJGL) and provides a much richer API, there are plenty of tutorials and links in this and other forums.  Guess it depends on your particular interests.

* EDIT: Actually a better suggestion might be Slick since I believe it's specifically orientated towards 2D OpenGL, not my sphere of knowledge but might be worth checking out?  http://www.slick2d.org/

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.

atombrot (23 views)
2014-08-19 09:29:53

Tekkerue (22 views)
2014-08-16 06:45:27

Tekkerue (21 views)
2014-08-16 06:22:17

Tekkerue (12 views)
2014-08-16 06:20:21

Tekkerue (19 views)
2014-08-16 06:12:11

Rayexar (57 views)
2014-08-11 02:49:23

BurntPizza (37 views)
2014-08-09 21:09:32

BurntPizza (29 views)
2014-08-08 02:01:56

Norakomi (36 views)
2014-08-06 19:49:38

BurntPizza (66 views)
2014-08-03 02:57:17
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!