Getting into newer OpenGL
some years ago I played a lot with OpenGL2.1 writing many demos that used basic features (mainly immediate mode) without caring about the whole shader approach.
Now I need OpenGL again for a personal project, from what I'm reading the whole approach to this kind of API changed since now almost everything is made directly by the GPU through vertex/pixel shaders.
I would like to know which are the main differences of actual state-of-the-art (I mean efficiency in development and in result) OpenGL compared to what I was used for.
Does any tutorial for who is coming from the old approach to OGL exist? Should I abandon my old ideas of applying transformations manually, drawing things with glBegin..glEnd
and so on?
Since I'm working with Java and I would like to use a good library, do you have any suggestions? I found LWJGL that seems quite good also if everything is already managed so I was wonde开发者_StackOverflow社区ring if it is worth using it or just stick to something more essential writing components as needed (like math related objects).
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.
There are some blog posts on Durian Software about modern OpenGL programming. It's in C, but it uses shaders (written in GLSL) extensively, so the amount of C code isn't that great.
According to Wikipedia, there are GLSL bindings to Java, so you might want to look into that.
Apparently, LWJGL supports shaders: http://lwjgl.org/wiki/index.php?title=GLSL_Shaders_with_LWJGL
Here's the link to the first blog post I mentionned earlier:
http://duriansoftware.com/joe/An-intro-to-modern-OpenGL.-Chapter-1:-The-Graphics-Pipeline.html
I hope that helps!
精彩评论