C++ Vs Java in 2D/3D Graphics?

Amiga Forever

Well-known member
AmiBayer
Joined
Nov 11, 2010
Posts
7,935
Country
UK
Region
Yorkshire
It seem to me that when come to coding..... In C++ as You have do the hard way of coding own graphics or choosing Graphics library for it where for Java...it got Graphics Build in as far as I know...

I dont want get into C++ Vs Java war threads but it would be nice to know what you know C++ Vs Java in graphics as then I will be able learn from :):thumbsup:
 
Graphics libraries for C++ are abundant and varied, and if you have any experience at all with C/C++ you should be comfortable with using third-party libraries anyway. I'd say it probably comes down to which language you're more familiar with.
 
C/C++ without a doubt.

Java is too slow in comparison
 
C/C++ without a doubt.

Java is too slow in comparison

Why do you think Java is slow?

From what I know is that Java is easier to learn than C++
 
C / C++ is far faster has it is complied into the systems CPU native instruction set and also optimised where as Java is not.
 
Why do you think Java is slow?

From what I know is that Java is easier to learn than C++
Well, if we are going to get into a language discussion...Java is a little easier to learn, yes, but it's not as easy to use; there are some really glaring oversights and/or design flaws that make doing real work in it a lot more of a pain than it needs to be:
  • You can only have one class per source file.
  • There's no preprocessor for including of other files, which means you can't keep constants in a separate header file.
  • Most aggravatingly, there's nothing analogous to C++'s "using namespace," which means that you have to refer to every library function by its full class path, every time you use it.
Even putting aside the question of performance, these three things are why I would never, ever try to build a real project in Java. It's like trying to pound nails with your forehead :/
 
Well, if we are going to get into a language discussion...Java is a little easier to learn, yes, but it's not as easy to use; there are some really glaring oversights and/or design flaws that make doing real work in it a lot more of a pain than it needs to be:
You can only have one class per source file.
There's no preprocessor for including of other files, which means you can't keep constants in a separate header file.
Most aggravatingly, there's nothing analogous to C++'s "using namespace," which means that you have to refer to every library function by its full class path, every time you use it.
Even putting aside the question of performance, these three things are why I would never, ever try to build a real project in Java. It's like trying to pound nails with your forehead :/

That is interesting :)

Making Game in C++ isnt easy task but if they used Game library then it shouldnt be a problem to make games.

GUI? I know C++ have GUI but it not good as java GUI I guess....correct me if I am wrong :thumbsup:
 
Java is about as difficult to learn as C/C++

In a lot of ways C++/Java OO have a similar approaches and syntax for the most part - I found "learning" Java something that could be done in a couple of days... although I should say that I find computer languages quite easy.

I manage to write a VOIP system that could interconnect 64 clients in a little over two weeks.

However, for me Java is a backwards way of thinking for target machine implementation as I honestly only see the JAVA language at best as a prototyping languge.

This is beause when it comes down to hard calculation routines (like backwards culling & Binary Space Partitioning - two very key area's for 3D graphics) in this regard even the best Java code will only see 70% of the performnce of C++ code.

You will need as much performace a possible for 3D graphics

(Don's Impervious suit of invulnerability - prepares for the C++ Haters)
 
GUI? I know C++ have GUI but it not good as java GUI I guess....correct me if I am wrong :thumbsup:
Depends what you're targeting. The Win32 native API isn't exactly intuitive, but I'm sure there's libraries to simplify it. GTK is portable across at least Windows, Linux, and Mac OS, and looks a good deal simpler to use, though I've never done anything with it myself.
 
Oh dear, I think somebody needs to update their Java knowledge and stop spreading misinformation.


Wrong. Only Java 1.0 had this restriction. But since Java 1.1 there are a number of different ways of defining many classes in the same file in Java. Besides, the number of source files you have is not important.

  • There's no preprocessor for including of other files, which means you can't keep constants in a separate header file.
How about you keep all/some of your constants in their own separate class.

  • Most aggravatingly, there's nothing analogous to C++'s "using namespace," which means that you have to refer to every library function by its full class path, every time you use it.
No you don't, use "import".

Anyway, back to the original question, the choice of Java versus C++ for programming graphics for me depends on what the graphics are for. What kind of program do you intend to write?
 
Wrong. Only Java 1.0 had this restriction. But since Java 1.1 there are a number of different ways of defining many classes in the same file in Java. Besides, the number of source files you have is not important.
Okay, that's good to hear. But a phrase like "Besides, the number of source files you have is not important" is exemplary of the attitude that drove me away from it in the first place. Java embodies the "stop that! We don't like it!" school of programming almost as much as Pascal does; I much prefer the "sure, whatever" approach C offers. If I want to group related classes into a larger source file, it's as important as I want it to be.
How about you keep all/some of your constants in their own separate class.
See above comments: I don't want to have to build whole classes just for the sake of holding constants other languages let me define simply and easily.
No you don't, use "import".
Still doesn't look like quite the same thing, but at least it's an improvement.
 
As a C/C++ VR programmer by trade I would get laughed at if I switched to Java (ROFL wheres the frame rate gone?). There is no comparison when it comes to raw speed. C/C++ wipes the floor with Java and always will.

To me Java is C++ with all the good bits removed (proper memory access etc). Its a bit like Apples walled garden which is fine and good until you want to get outside the box. C/C++ has no limit which means you can hang your self in many many ways but at least its your own choice/code that does it. Even Android provides a NDK so that C/C++ can be used in speed critical sections.

A good run down of the differences can be found here: http://en.wikipedia.org/wiki/Comparison_of_Java_and_C++

There will be a system in Leicester Museum within the next month or so which I will have written which renders 3d to 4 independent screens, try doing that in Java :-D
 
@Amiga Forever

Java is a great prototyping languge -

Thats to say its good for testing things out, ironing out the problem. It helps you get into the OO mindset quite quickly, however Java IS NOT a final implementation lanugage, while its been proven to run enterprise level tasks well on servers what you are not being told is that these have machine specific optomized code - which defeats the purpose of Java IMHO.

Right now I could start writing Java programs and applets to do simple things and if I want to disseminate them on *Nix and Windows - its truly great and thats exactly what I did at UNI when I wrote a Voice over IP client and host program.

This would start to fall over with more than 60 clients connected, my delta and hoffman compression encodings (which was in java as well) wasn't running fast enough and thats when massive packet loss happened (mainly because it cannot keep up) - this ranges from excessive lag to the incomming sound being so broken that it was inaudiable.

Now you might wonder how signal processing releates to graphics, well I will be honest with simple (and I mean Simple) 2D stuff, Java, with a pokey computer will do well... however - get into complex layering techniques and sprites / gels / bobs and anims - you are in for a nightmare under Java.


C / C++ not only offer up the Raw power of the target CPU/GPU to the programmer, they also come with the legacy of an emense library of functions and online help (while java does have a good community, its code base is no where as big as C or C++)

In good conscience I cannot recommend Java as a 2d/3d development platform, dont get me wrong it is a handy prototyping language for non runtime critical tasks - but with reall number crunching, you need C/C++ or infact any language that gives you such unfetted access to the target machine.
 
that is interesting to read and good to learn from.

When I look at C++ Game Library as they have

SDL
Allergo
SFML (Which most people using them when they switch from SDL to SFML)

Had anyone try SFML?:unsure:
 
Never tried SFML. Allegro, from what I've seen, looks very featureful and game-oriented, which is probably good for what you're looking todo; I prefer SDL, as it's just about as simple as you can get and still be cross-platform.
 
I prefer SDL as it is the most cross-platform independent.

Also it will give you the opportunity to develop your own libraries and graphical functions as well as learn some of the more complex stuff without it being behind some other class or compound library.

Now would be a good idea to tell you goto Neon Helium


You will understand when you get there....
 
Also it will give you the opportunity to develop your own libraries and graphical functions as well as learn some of the more complex stuff without it being behind some other class or compound library.
Yeah, exactly. I've learned more about 2D rendering putting together my own primitives with SDL than I ever would have using a third-party library. A lot more work, granted, but you get so much out of it.
 
Back
Top Bottom