OpenGL SuperBible: Comprehensive Tutorial and Reference (5th Edition)

Category: Programming
Author: Richard S. Wright
3.2
All Stack Overflow 8
This Month Stack Overflow 2

Comments

by anonymous   2019-07-21

Actually this question is asked earlier.. OpenGL on Android using C++ only may be its useful for you.. But the correct approach is first learn opengl because opengles is like a subset of opengl. here a link for a good book http://www.amazon.com/OpenGL-SuperBible-Comprehensive-Tutorial-Reference/dp/0321712617/ref=sr_1_2?s=books&ie=UTF8&qid=1318312610&sr=1-2

by anonymous   2019-07-21

The differences between the old immediate mode and the new way of doing things are pretty huge. There surprisingly not that much good content out there, you can ignore 99% of OpenGL tutorials around the web.

The positive thing with LWJGL is that once you understand the differences between LWJGL and the regular OpenGL calls you can usually use tutorials from other languages.

The only 3 good resources I could ever find were:

  • "An introduction to modern OpenGL" http://duriansoftware.com/joe/An-intro-to-modern-OpenGL.-Table-of-Contents.html (this is a great intro but sadly there hasn't been a new tutorial in a long time)

  • OpenGL Superbible fifth edition (this is the only book that covers the new way of doing things, and is really a must for anyone getting back into OpenGL) http://www.amazon.com/OpenGL-SuperBible-Comprehensive-Tutorial-Reference/dp/0321712617

  • Java Monkey Engine uses LWJGL as it's only fully supported renderer (last time I checked), browsing it's source is an education in engine design for LWJGL http://www.jmonkeyengine.com/

Also, LWJGL is great. It won't give you a higher level of abstraction since it's just a thin wrapper around the C calls (but this also means it won't do a mediocre job at trying to make OpenGL OO), plus it's pretty performant. LWJGL doesn't provide a great deal (even for math) so you're most likely going to need to acquire (or as a last resort write) math libraries for anything complex.

by anonymous   2017-08-20

The answer really depends on whether this game is 2D or 3D.

If your game is 2D, an easy way to do what you want is to use Java's own 2D Graphics API. A good tutorial to start you off (at least in my opinion) can be found at The Java Tutorials. In my experience I have found that Java's graphics API is easy to learn, and is more efficient than one might expect. The basic technique is to have your game code keep track of the positions of all your objects, then translate those coordinates into screen coordinates and display appropriate images at those locations. I made a (very, very simple) game in Java once, and this is the method I used.

If your game is in 3D, OpenGL is definetly the way to go. I have only limited experience with OpenGL, so I'm not sure how easy the Java bindings are to work with. In general, 3D programming is a massive topic, so if this is a first-time project or you aren't prepared for a major time investment, I would attempt to find a good game framework to use or make the game 2D. If you are interested in OpenGL, or 3D programming in general, a quick Google turned up the JOGL project. I would recommend investigating JOGL as a way to access the OpenGL API from within Java code, but for actually learning OpenGL I recommend The OpenGL SuperBible(5th edition), commonly known as "The Blue Book". The code examples are all in C++, but for the OpenGL functions it could possibly be just a matter of using a wrapper library. For example:

glDrawElements(...);

May become:

JavaGLWrapperObject.glDrawElements(...);

Unfortunately I can't give concrete examples because I haven't used OpenGL with a Java program, but the above example very coarsely approximates how OpenGL ES is used on the Android platform.

As far as performance... Java's API comes with a non-trivial ammount of overhead, but I could see it doing alright for your purposes. You may have to put a little more effort into making your algorithms efficient, and your game may not run as well on less-capable hardware. If you do decide to go the OpenGL route, it will almost certainly be much faster (again, depending on how efficient your algorithms are), but is correspondingly much harder to learn and get started with. Certainly doable, but it will be a challenge.

by anonymous   2017-08-20

The 5th edition of OpenGL SuperBible has been recently released. This edition reflects OpenGL 3.3 which was released at the same time as OpenGL 4.0, the book only covers the core profile and assumes no prior OpenGL knowledge.

That's what I got from the book's description anyway. I have the 4th edition and it's an excellent resource for OpenGL 2.0, so I assume the new edition along with the latest OpenGL Shading Language book would be just what you're looking for.

Durian Software has an ongoing series of tutorials covering modern OpenGL. They are aimed at OpenGL 2.0 but avoid using any deprecated functionality in later versions.

by anonymous   2017-08-20

NeHe is in the process of writing new tutorials. Some of the things you may have been used to 10 years ago have been more or less abandoned (compatibility profiles are still around, but they're deprecated) in moving to a fully-programmable pipeline and more efficient primitives.

For example, passing vertices between glBegin()/glEnd() is being left behind in favor of vertex buffer objects and vertex arrays. The old transform and lighting model is going away in favor of fragment shaders.

I'd suggest starting with Joe Groff's intro to modern OpenGL, and get a copy of The OpenGL SuperBible, 5th edition, which covers all of the new ways of doing things.