Moving from Java to C++ API's - java

There are some particular API's in Java that make it very good. However I would prefer C++ because of performance and "bleeding" edge support with OpenGL and OpenAL among the many libraries.
Which API's are there that are similar to Java2D (I know I can use OpenGL however I lack the matrix math understanding to fully use OpenGL in this way)? Also which GUI framework (non-native; platform independent) is the most used in C++?

FLTK, Fast Light Tool Kit has some 2d functionality. It's somewhat like swing and 2d mixed together. It does focus more on the UI aspect but it may help you out.
http://www.fltk.org/

If you want platform independent GUI framework for C++ check Qt.

I can't speak much for Java2D equivalents but as far as GUI frameworks go, I've heard of two:
wxWidgets: http://www.wxwidgets.org/
Qt: http://qt.nokia.com/products/
Both of these are cross-platform and I believe widely used.

Try GTK--. It has some features that make it a bit nicer an API than either wx or Qt.

Related

JOGL or LWJGL pre-existing project

I've noticed that using the Java libraries that are default built in, rendering the simplest graphics absolutely kills the FPS, and furthermore, looks ugly.
Now I was wondering if I could use JOGL or LWJGL libraries to use in my pre-existing program. (I'm making a game which renders cubes as planets, and you have to build planets.) Do I need to completely rewrite my code? Or can I just install these and render freely? And which one of the above is easier to understand, because I have limited knowledge in these libraries.
Btw, right now, I am using JFrames, does that need to go as well?
Also, what is OpenGL, is that good to use as well without rewriting code?
OpenGL is a standardized graphics interface for use between programs and your graphics card. A proprietary version of this by Microsoft is known as DirectX. LWJGL and JOGL are two different Java bindings to OpenGL libraries, both of which have native code they load in.
LWJGL is much more aimed towards gaming with OpenGL, where as JOGL is more worried about complete and perfect bindings to OpenGL/OpenCL. I would recommend LWJGL if you're just getting started.
You're going to have to rewrite your rendering code, yes. But assuming you designed your project well, you shouldn't need to rewrite the game logic. JFrames will probably also have to go, but I'm not completely sure about that.
Please don't turn this question into another "JOGL vs LWJGL" thread. Moreover, JOGL is used in several games including Poxnora and Salem (MMO). You'll have to learn OpenGL if you want to use any Java binding of this API anyway.
Finally, you can use GLG2D in order to get a better hardware acceleration with plain Swing, it would allow you to benefit of better performance only with a very few changes in your program. GLG2D relies on JOGL 2, you can find more information about it here: http://brandonborkholder.github.io/glg2d/

C++ vs Java in Android

I'm interesting in start a game development. I currently did some openGL in C++, but now I'm looking for the options that offers Android, and I have found people who developes his games using Native code (C++) and others that use Java...
So I don't really know which is the main difference. I read that many people has experience using C++ and prefers this one to don't have to learn new things using java... but I don't think this is the main reason.
What are the main differences developing a game using C++ or Java? Perfomance? Scalability? Posibilities?
Also, do you recommend to start the game development using OpenGL?
I would suggest using whichever language you are more comfortable with. A game is never a small project, and since you are new to the process (judging by this question) you will probably not be concerned with any performance differences or anything like that.
To answer your questions:
Performance
see C++ vs Java Performance, Android: Java, C or C++?, etc.
Possibilities
There is nothing inherit that C++ can do and Java can't, or vice versa when it comes to your goal.
Scalability
Not sure what you are asking with this one.
C++ can perform better than Java (don't believe the naysayers, do your own benchmarks), but there is more support for Java on Android. In the end it depends on how intensive your app is going to be and how much battery it is going to drain. If it is extremely intensive, go with C++ because you can do more with less. If it doesn't matter, then go with Java.
at the end it doesn't matter sense if you use c++ you will need to learn all those frameworks used for android development, if you use java you will learn java and openGL is the same in all languages so just go with c++ if you are a c++ developer
Also, do you recommend to start the game development using OpenGL?
you should not start with OpenGL not that you can't but I would sagest something like SFML witch will teach you a lot about graphics programming then you can move to OpenGL

Graphical operations in C++ through the JNI

I'm writing an online multiplayer game, and I'm thinking about implementing the network code in Java, using JBoss Netty. But I'm considering C++ for the 3D rendering (they're simple graphics, nothing extensive). Would it be worth implementing such behavior in C++?
Would it be worth implementing such behavior in C++?
No, I would recommend doing everything in java or in c++. That way you won't have any problems with c++ to java interoperability. In case you already have the network code in java I would go for that.
If you choose java you can use a 3D rendering library like for example jogl or lwjgl. These libraries are really light weight and you will probably not have any problems with the actual rendering performance since it is done by the graphics chip.

Game programming with Java in Linux

Recently I've been craving some game programming. I primarily use Linux, and was wondering if there are any good graphics libraries for Java development on Linux? Google didn't turn up very much useful information on the subject.
Also, would another language be better? I would like to avoid using python -- Ruby and Java are my two favorite languages. There doesn't seem to be much talk about game programming on Linux in general, unfortunately.
Any suggestions/resources? Easy portability or cross-platform functionality would be awesome too.
Oh, and I prefer 2D graphics.
What about the APIs mentioned in Pro Java 6 3D Game Development: Java3D, JOGL, JInput and JOAL APIs.
Topics are split into three sections: Java 3D API, non-standard input devices for game playing, and JOGL. Java 3D is a high-level 3D graphics API, and JOGL is a lower-level Java wrapper around the popular OpenGL graphics API.
You'll look at three non-standard input devices: the webcam, the game pad, and the P5 data glove.
Along the way, you'll utilize several other games-related libraries including: JInput, JOAL, JMF, and Odejava.
Learn all the latest Java SE 6 features relevant to gaming, including: splash screens, JavaScript scripting as well as the desktop and system tray interfaces.
Or have a look at Java 2D Game Frameworks here on SO.
For game programming there's a nice little framework available, jMonkeyEngine, it support both LWJGL and JOGL.
JOGL is supposed to be cross-platform. There's a wrapper which includes additional functionality called Lightweight Java Game Library.
How about Flash? The PushButton Engine looks fun.
Golden T Game Engine
I think the Golden T Game Engine is the sort of thing that you are looking for. It makes it very easy to get into actually making a game without having to worry about a lot of boilerplate code.
Golden T Game Engine (GTGE) is an advanced cross-platform game programming library written in Java language.
GTGE library provides a complete routines for making 2D game from low level routines such as hardware accelerated 2D graphics, mouse and keyboard input, audio support, game timing, to game specific routines such as sprite, background, collision detection.
...
GTGE is a high level interface library, it means programmer never has to worry about any low level commands anymore. The only thing left for the programmer is use their imagination and start programming their game.
You don't have to know anything about managing graphics, input, and other low level stuff in Java. Instead you can start immediately develop your own game using the latest Java technology, such as bufferstrategy, volatile image, and even OpenGL easily. You can check out GTGE design standard simplicity, generic, and replacable.

Learning OpenGL through Java

I'm interested in learning OpenGL and my favorite language at the time is Java. Can I reap its full (or most) benefits using things like JOGL or should I instead focus on getting stronger C++ skills?
Btw, which is your Java OpenGL wrapper library of choice and why?
JOGL is a wrapper library that allows OpenGL to be used in the Java programming language. It is currently the reference implementation for
JSR-231 (Java Bindings for OpenGL) so it should be your first choice
I have done some basic OpenGL development in Delphi and Java as well. I used JOGL, as mentioned in others' replies, and I must conclude that although there is very little difference in programming OpenGL in Java using JOGL and programming OpenGL in other languages (Delphi, C++, etc...) it just doesn't feel right. It was driving me crazy to set it all up correctly and then writing stuff like
gl.glBegin (GL.GL_QUADS)
there seems to be a lot of superfuous gl, GL, GLU to be written and it just gets in your way. Also the performance would be, I believe, much better if you used C++ or similar, NOT Java.
I am not saying hands off JOGL (Java+OpenGL), it can be done, and it really isn't too different, but... as I said. Give c++ a try, if you can.
If you are also interested in just doing 3D stuff in Java without worrying about all that low-level stuff, check out Java3D.
Worst case, you can look at how they leverage OpenGL for some good learning material.
if you really want to get serious at 3d programming you have to learn C/C++, C++ is the standard for programming 3d games
Do it in C++, the bits you'll be using will basically be the same, because there won't be much messing about with pointers, so it's not a major leap of intuition. Also, the C++ bindings are more reliable and (in my experience) the fastest out of all the langauges available (Python in particular REALLY can't do OpenGL).
Also, C++ is always a good thing to learn, it makes you think about programming concepts in much more detail, as opposed to just popping in an ArrayList<> or whatever pre-built class kind-of-serves your purposes =]

Categories