Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the following list of languages:

  • C++
  • C#
  • VB.Net
  • D
  • Delphi
  • Euphoria
  • GLUT
  • Java
  • Power Basic
  • Python
  • REALbasic
  • Visual Basic

I would like to know what people think is the:

  1. Best (most efficient) language to work with OpenGL?
  2. Easiest language to work with OpenGL?
share|improve this question

closed as off-topic by gnat, MichaelT, GlenH7, david.pfx, Ampt Aug 1 '14 at 2:54

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions asking us to recommend a tool, library or favorite off-site resource are off-topic for Programmers as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – gnat, MichaelT, GlenH7, david.pfx, Ampt
If this question can be reworded to fit the rules in the help center, please edit the question.

You forgot the correct answer which is C as in the C Language which is what the OpenGL API is written in. – Jarrod Roberson Jun 26 '12 at 4:42
up vote 7 down vote accepted

OpenGL is a framework, a precompiled library in external DLLs, so asking what would be the "most efficient language" to work with it is kind of nonsensical, since pretty much every language does external function calls exactly the same way. But if you're worried about efficiency in an OpenGL project, you're probably working on a game, and you'll want to compile to native code to make other stuff, such as game logic, work quickly. That rules out the .NET languages, Java, Python, and (I think) most if not all of the BASIC dialects. I've never heard of Euphoria before, but some quick Googling says that it's an interpreted bytecode language, so we can rule that out as well, leaving you with C++ and Delphi.

If you had to choose between C++ and Delphi, Delphi would be a clear winner based on your second criteria, ease of use. Delphi code is much easier to read, and its object model and various parts of the language semantics are better thought-out and less prone to unexpected pitfalls. In Delphi things you don't really understand tend to go right, whereas they tend to go wrong in C++. I'm actually building a game engine in Delphi myself, and it's been a lot of fun to work on, where a lot of the issues I've had to deal with would have been a real horror to resolve in C++.

share|improve this answer
Maybe I'll try Delphi! ty! – Barrie Reader Jan 10 '11 at 9:02
Good answer though you are incorrect that Java etc. are "ruled out" - Minecraft is a great example of an OpenGL game written in Java. Java does compile to native code (via the JIT compiler) and does provide facilities for calling native code libraries such as OpenGL (via JNI) – mikera Jun 19 '11 at 10:37
@mikera: You're right, of course, but Minecraft is a poor example, since its algorithmic approach to graphics is quite poor. (It lacks proper visibility culling, for example.) – greyfade Jul 5 '11 at 3:25

C++ has always been a very good language to use with OpenGL. There are a lot of resources out there to help/support you on your development journey.

share|improve this answer
We used C# and OpenGL in my senior project, and our graphics guy constantly bemoaned that he couldn't use C++. – Michael K Nov 3 '10 at 12:45

I work a lot with OpenGL in Delphi. Its not that much different from working with it in C++. Often you can almost copy/paste examples between the two. But, as most examples you'd find online and in books are in C++, it would still help greatly no matter what language you are using to be fairly familiar with C++.

share|improve this answer

C/C++ will be most efficient - it will give you access to the minutiae of memory management and hardware access that you wish you didn't have to deal with but is necessary to squeeze the maximum performance out of your hardware. It's also the industry standard for high performance graphics and games. Strongly recommended if you're a professional game development shop trying to create the next big blockbuster title.

Anything except C/C++ will probably be much easier. The same features of C/C++ that give you a lot of power and control make it complex and hard to maintain. Also there are many other factors that influence "ease". If you want ease I'd recommend using a language that has:

  • Built-in garbage collection and memory protection as standard
  • A great and well-maintained OpenGL library / set of bindings
  • Cross platform capability (so you don't have to rewrite or rebuild for every hardware configuration!)
  • Good standard tools and IDEs
  • Mature libraries for the problem domain you are targeting (particularly open source libraries)
  • A strong standard deployment platform / runtime environment
  • A large / helpful / vibrant community

Various languages would fit this bill, but I'd personally recommend one of the newer JVM languages (Scala, Clojure) coupled with LWJGL which is a pretty good set of OpenGL bindings. If you want more than just OpenGL and actually want more of a complete game/3D simulation engine with physics etc., then I'd recommend jMonkeyEngine (which uses LWJGL under the hood).

share|improve this answer

OpenGL is kind of designed to work with C++ so that would be your starting point. Even if you're working with a language like Java you are likely to spend a lot of time making native calls or using a library like LWJGL that makes lots of native calls on your behalf.

That doesn't mean it's a bad idea to use a language that insulates you a little from the trickier aspects of life with C++. If it were me I would use Java, just because I know the language pretty well, although with Oracle thundering around the place like a bull in a chinashop I don't know how well it will last.

I would avoid the .net languages as they are more closely designed to tie in to Direct3D, or learn to use Direct3D - there isn't much to call but if you want to be cross platform you probably don't want to be using D3D.

All of that said, there is a slight question of what you want to do with OpenGL. Often people are interested in games development and if you are then I strongly recommend that rather than involving yourself in the base level of engine development you use an existing engine ( of which there are hundreds in pretty much every language you can think of ) rather than reinventing the wheel- you can always enhance things about an open source engine as you need to, if you need to - you start with a solid foundation that allows you to create something interesting more quickly.

share|improve this answer

As a school project we had to create a 3d environment with OpenGL. Using C++ to create an OO wrapper around OpenGL and the Qt framework to use some handy library functions really made things a lot easier. You can read about Qt's OpenGL widget here.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.