Netbeans, LWJGL, Java2D, JOPS, OpenGL

Started by Gheta, August 02, 2009, 02:08:35

Previous topic - Next topic

Gheta

Hello, I'm a new game programmer and I'm in a bit of a tight situation and need some help/ideas.

I have been making a space game using Netbeans and Swing/AWT/Java2D. I have JLabels with the space crafts in them flying around on a JPanel. I have gotten past loads of crazy formulas with success and I was just about to move on to Particle Engines for flames and weapons. Sadly Particle Engines seems to suck in Java2D and there are no Java2D Particle Editors around anymore.

Then I found JOPS, Java Open Particle System that apparently works with LWJGL and OpenGL, 3D in Java. Then I searched around and found that you really can't mix Java2D with LWJGL 3D well. I see things like, why work in Java2D when you can just do OpenGL and work 2D in that way? So I've set up Netbeans to work with LWJGL and OpenGL, but I'm having a lot of questions.



Can't I just create a GLCanvus underneath my transparent JPanel and work that way? using the JPanel for the JLabels holding the ships and the GLCanvus to have my weapons/lasers/shipjetfire?

Do I need to have a GameWindow instead of Netbeans Frame I'm using?

Do I need to translate most of the code to OpenGL/LWJGL code for it to work properly/fast?

Do I have to translate everything including AWT's KeyHandlers to LWJGL's?

Or do I have to just translate my little code using graphics g g2d transformations?


Then my last question might be a little harder here. I created ops, that is, cool particle effects on Java Open Particle System, they were saved in their .ops file format. How can I implement that into OpenGL under my ships on their coordinates?

Gheta

Sorry for the double post.

I have really been thinking about just using JOGL instead, it has a nice pack for Netbeans. You can put OpenGL in Swing Components fine and vice versa. I can put a GLCanvus behind my transparent JPanel and draw like that hopefully. Why are there almost no Particle Engines for JOGL OR LWJGL, just for game engines that are placed on top of JOGL or JWJGL like GTGE, JME etc?

Kai

QuoteYou can put OpenGL in Swing Components fine and vice versa.
Well, you can do that with LWJGL, too.
Try to use an AWTGLCanvas, which is an AWT Canvas whose "paint" method is overridden to make a GL context current and execute a new "paintGL" method, which is to be overridden by the programmer in a subclass of AWTGLCanvas.

QuoteWhy are there almost no Particle Engines for JOGL OR LWJGL, just for game engines that are placed on top of JOGL or JWJGL like GTGE, JME etc?
Maybe because it would be of limited use to "only" have particle effects. Don't forget that the graphical part of LWJGL and JOGL are basically just OpenGL Wrappers for Java that do not provide "high level" effects, such as particles but only allow to access the native OpenGL functions.

Gheta

QuoteMaybe because it would be of limited use to "only" have particle effects. Don't forget that the graphical part of LWJGL and JOGL are basically just OpenGL Wrappers for Java that do not provide "high level" effects, such as particles but only allow to access the native OpenGL functions.

JOPS is just a particle engine and it supplies code for you to put the particles you designed in the supplied program into your Java lwjgl programs, it works kind of like a library. There isn't anything else like that for lwjgl and jogl?

QuoteWell, you can do that with LWJGL, too.
Try to use an AWTGLCanvas, which is an AWT Canvas whose "paint" method is overridden to make a GL context current and execute a new "paintGL" method, which is to be overridden by the programmer in a subclass of AWTGLCanvas.

Yea I noticed that, I was playing around with the AWTGLCanvus for a while.



My problem with OpenGL, is that I figured I was a good programmer - with all the languages I know and the A's and B's I got in all my college programming classes. I even tutored HTML and VB.net. I can easily do Java2D fine, but when I got to OpenGL, I have had problems after executing a Frame and making a canvus, I can't do crap nor am I able to learn it well. I'm struggling even with tutorials, yet I cannot stay with Java2D, I must do this.

Any answers to my other questions?

Fool Running

QuoteJOPS is just a particle engine and it supplies code for you to put the particles you designed in the supplied program into your Java lwjgl programs, it works kind of like a library. There isn't anything else like that for lwjgl and jogl?
In looking at JOPS (since I was curious), it looks like someone has made a version of JOPS for the JMonkeyEngine which is based upon LWJGL. I'm not sure what you might need to get it to work for you, but you might look at that.
Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option ;D

Gheta

QuoteIn looking at JOPS (since I was curious), it looks like someone has made a version of JOPS for the JMonkeyEngine which is based upon LWJGL. I'm not sure what you might need to get it to work for you, but you might look at that.

Well the thing is, I heard that JME doesn't work for Netbeans. Also I read something in JOPSs forums, and someone was talking about making a JOGL port of it, since it only works for LWJGL. Someone made the port, posted it years ago I believe, and it disappeared on the internet. They said it was more than just changing the rendering. Now, someone at my level couldn't do that. If I could get either a JOGL port, or someone to show me the code of putting it in my Netbeans program using LWJGL that would be awesome.

Kai

QuoteWell the thing is, I heard that JME doesn't work for Netbeans.
Apologies for my following rather harsh statement, but this is complete rubbish. Netbeans is just an IDE, like Eclipse is. You are not bound to that when developing a java application. You could easily just use a simple text editor; though you would be missing some nice features such as refactoring and stuff.
When running a java application via Netbeans or Eclipse, both just invoke the javac compiler (for classes were not already compiled) and then java (or javaw) with appropriate command line arguments to start some class that as a "main" method in it.
That's all there is to java applications.
If you heard JME doesn't work for Netbeans, then that might mean that there is not an Netbeans-integrated plugin available for JME that allows you to make your IDE "aware" of JME and to click on some buttons in the IDE that are then somehow related to JME, but you don't need that.
Having .net background, as I interpreted from your postings, you might have gotten the impression that one cannot develop a .net application without MS Visual Studio and hence any application without the appropriate IDE. That is also not true :-). The compiler for .net is just so tightly coupled to the IDE that you have to have VS in order to do .net. Well that is not the case with java.

Maybe you could also take a look at Java3D. It's a scene-graph based API for developing graphical applications, such as games. They might have some kind of particle engine there, too.

Gheta

You are not harsh, I understand.

Quoteyou might have gotten the impression that one cannot develop a .net application without MS Visual Studio and hence any application without the appropriate IDE. That is also not true :-).

Actually I've programmed in many languages, for all the web languages I know I use a text editor, and Java and C++ I've started with using a dinky text editor and either Linux or DOS command lines... The only IDE I've ever done before was VB and I hate it, I do not recommend the .net framework to anyone because of the lack of platforms it is on and the lack of people even wanting to use it. Then I found that Java has IDEs later on and it has made things a bit easier for me so I prefer using them.

I've also read that there are tutorials on how to integrate JME with Netbeans, but once again I do not wish to use something (game engine) that is making my game for me, the IDE (and someone's particle engine if I use one) already does that enough.

As for Java3D I heard it is really crappy in comparison to JOGL and LWJGL, but the easiest to learn. I guess I'll look it up, but I really want to learn the other two.

Kai

QuoteAs for Java3D I heard it is really crappy in comparison to JOGL and LWJGL, but the easiest to learn.
Well Java3D is an abstraction layer above OpenGL and Direct3D in that it uses a "scene model", that is, a data structure describing what you want to draw and the OpenGL and Java3D backends interpret these data structures and translate them to OpenGL or Direct3D calls.
You certainly can achieve more things with plain OpenGL compared to using the scene-graph abstraction.

Quote... but I really want to learn the other two.
That's nice to hear. The first thing I would recommend you to do then is to learn about OpenGL in general. Try to work yourself through the nehe tutorials http://nehe.gamedev.net/default.asp.
The tutorials contain code that is also ported to LWJGL as well as JOGL.
But learning LWJGL or JOGL should now be considered equivalent to "learning OpenGL", so it makes no difference if you use C with the native OpenGL functions or a Java port like LWJGL or JOGL.

Good luck!