PDA

View Full Version : Old Compatibility OpenGL vs modern Core OpenGL profile



thor36
02-04-2015, 07:20 AM
Greetings!

I am facing a bit of a dilemma, that I cannot solve due to my lack of knowledge about the course of OpenGL project.

I have an engineering background and I use OpenGL to develop simple simulation/visualization in 2D and 3D. I have used the "old-style" OpenGL because it was easy for me to learn and I also get the program working rather quickly due to its straightforwardness and ease of use. I really like OpenGL and will definitely continue using it for the future projects, which will build on complexity and features used from the ones I did so far. But despite growing complexity, I think in general 'OpenGL terms', projects will still be considered simple. By that I mean it will be nothing like sophisticated game engines, awesome rendering effects etc.

So to the point - my dilemma is whether I should continue using "old-style" OpenGL, or should I invest the extra effort to start learning modern OpenGL? There are several aspects I've been considering, and I cannot arrive to a proper conclusion.

I would consider sticking with "old-style" OpenGL because it seems to suffice for what I do. It is easy. It works on older machines too. But I am worried about things like possibly less and less support available. Maybe some day even total removal of compatibility profile? And also lack of keeping up with modern graphical software design (this would only be a big problem if I ended up in actual graphical development, which isn't that likely, but anyway). Also learning curve for modern OpenGL is quite steep and I can't really say that I have abundance of time, nor can right now see how taking that effort would pay off.

I would like to hear your advice, please. If I didn't share enough info or details please let me know what I missed, I will gladly elaborate. Thank you very much,

best regards
T

__bob__
02-04-2015, 07:32 AM
Hi!

I'have a (stupid?) question : why dont use a frameworks like three.js in webGL? Every things is done for you by three.js... and it works every where...

Alfonse Reinheart
02-04-2015, 07:41 AM
Maybe some day even total removal of compatibility profile?

That ship essentially sailed years ago on Mac OSX. They only provide core profile support for GL 3.2+, though they do provide GL 2.1 support. But that means you can't use higher features and compatibility stuff.

That being said, with the whole "Next-Gen GL" coming up in the next year or 15, I doubt anyone's going to be rocking the boat as far as standard GL is concerned. So platforms that support compatibility today probably will next year too.

A far more pertinent question for you is this: what happens if someone needs to you port your application to mobile platforms? There, OpenGL ES 2.0+ (you don't want to try 1.1) is your only option. And it has no equivalent to compatibility stuff. It's all shader, all buffer objects, all the time. If that looks like a possibility to you, then the sooner you learn shader stuff, the better.

If that seems unlikely, then by all means, stay the course.

Alfonse Reinheart
02-04-2015, 07:45 AM
Hi!

I'have a (stupid?) question : why dont use a frameworks like three.js in webGL? Every things is done for you by three.js... and it works every where...

If by "every where [sic]", you mean where WebGL and JavaScript are available, sure. And of course, you have to live within the limitations of three.js. And are willing/able to program in JavaScript. And debug complex applications in JavaScript. And can access your engineering data from wherever it is through JavaScript.

The thing about using the JS ecosystem is that you have to use the JS ecosystem.

GClements
02-04-2015, 03:38 PM
If you plan on continuing to use OpenGL, you should learn modern OpenGL.

OpenGL ES 2/3 doesn't have the legacy stuff, WebGL (which is basically OpenGL ES 2 in JavaScript) doesn't have the legacy stuff, MacOS X only supports core profile for OpenGL 3+, in all probability "next generation" OpenGL won't have the legacy stuff.

The learning curve isn't that steep if you're already familiar with the legacy API. Using the compatibility profile, you can replace one deprecated feature at a time until you don't use any. Replace glBegin/glEnd with client-side vertex arrays. Replace client-side vertex arrays with VBOs. Replace the fixed-function pipeline with shaders which use compatibility variables. Replace the compatibility variables with user-defined uniforms and attributes.

thor36
02-26-2015, 06:49 AM
Alfonse Reinheart and GClements thank you both for great input.

From what you both have said, learning and switching to modern OpenGL does seem like a good idea. However I am intimidated when I see "basic triangle" examples done with core profile, comparing to few lines of code that did it in legacy OGL. Besides the Red book that I have used for learning is getting rather negative reviews for its modern editions. There is also GLSL, something I've never touched before, so another new thing on the list.

I will try to start with some of the available online tutorials and return to this (really great) forum for some help when it will be needed :) Thank you

GClements
02-26-2015, 11:24 AM
However I am intimidated when I see "basic triangle" examples done with core profile, comparing to few lines of code that did it in legacy OGL.
IMHO, it's better to start with legacy OpenGL until you have some familiarity with the basic concepts, then switch.

If you try to use modern OpenGL from the outset, you have to learn several distinct concepts before you can draw anything, and learning each concept is made harder by the fact that it can't reasonably be understood in isolation from the other concepts.