Things that drive me nuts about OpenGL
richg42.blogspot.com
richg42.blogspot.com
For example, when nothing renders, I don't want to waste an hour, staring at my code with no direction, until I realize I forgot a call to glEnableVertexAttribArray. Instead, I'd like to boot up my trusty debugger and go through a sane process of narrowing down the problem, like I do for just about every other class of bug.
Also a sane way to debug shaders would be fantastic. The usual advice is to write debug info out as color values. The fact that anyone considers that a healthy debugging strategy just illustrates how far behind graphics programming is in terms of developer friendliness.
I don't know if it's better on other APIs. OpenGL is the only one I use, because I never have occasion to develop Windows-only apps.
Anyway, this seems closed-source. Are there any open-source equivalents?
Other then that I don't even think of OpenGL as a single standard anymore. It's more like "Nvidia GL" "AMD GL", "Intel GL", "Apple GL", etc... there is a core set of functionality which works across all implementations (and which could be cleaner), but if performance is more important then easy portability, you need to implement driver specific code paths anyway. Whether this is good or bad I haven't yet made up my mind completely. At least on GL you have an environment where GPU vendors can experiment and compete through extensions.
I think that's fine, because as you said, it encourages GPU vendors to innovate. Plus, it probably affords more of an opportunity to squeeze every last drop of performance out of each card.
On the other hand, I'd start to get upset if we had to write card-specific code just to do the absolute basics. (Which isn't the case right now.) There are tons of apps that need only a tiny fraction of the performance a GPU offers. For those apps, it would be insane having to maintain multiple codebases just to, say, draw a box with a texture and Lambert reflectance.
* GL extensions are written as diffs vs the official spec
So if you're not a OpenGL Specification Expert it can be extremely
difficult to understand some/many extensions.
This is spot on. I was thinking last week about writing a webapp that displayed the spec with a list of extensions you could check to have them merged in.Then I decided I was yak shaving and went back to actually working on my project.
If you skim the text of an extension [1], you'll see an awful lot of this:
> Add a new section "Buffer Objects" between sections 2.8 and 2.9:
It'd be very nice to read those sections without having to have the full spec open in another window. Especially because some other extension you're using might be modifying the text as well.
1: http://www.opengl.org/registry/specs/ARB/vertex_buffer_objec...
Meanwhile in Direct3D9, the game still runs smooth at 60+ fps on all major drivers on most recent hardware. Granted, it's a bit of an Apples vs Oranges comparison, but it certainly causes a lot of headaches especially when you need to go so far as to modify the art so it batches better.
There is also still a lot of conflicting information on how best to use OpenGL. OpenGL 3.x certainly helped by consolidating a lot of stuff which was in extensions, but in my case its not really that good for me as I still have to put up with the land of OpenGL 2.x.
Ha, where I work we still get support tickets about our ancient GL1.5 renderer from time to time. If only we could drop it.
And then I get home and see people on /r/gamedev suggesting that OpenGL 3.2 is outdated and not even worth supporting anymore. I even got downvoted for saying that my less-than-three year old laptop ran GL3.2. Maybe I'm just in need of an upgrade...
Huh? Performance, maybe, but how is "mindshare" being measured here?
DirectX "beat" OpenGL a long time ago - does the author claim OpenGL beat its way back to the top? If so, I can only assume that was due to GL on mobile platforms. But those mobile platforms - iOS and Android - still use GL, and are growing? How can D3D12 and Mantle beat those when they don't even run on those platforms, while Windows - the platform they do work on - is anyhow already under DirectX control?
Furthermore, GL is seeing another area of growth through WebGL, which now works on even Microsoft's browser.
Am I missing something? That mindshare statement seems completely off base.
I mean, you don't really think he has no idea what he's talking about, right? Then game dev world is really, really big. It's worth noting he has worked at Valve for some time, so he's coming from the Gabe Newell world.
Of course, I'm only talking about smokin' fast and shiny AAA gaming, where D3D currently dominates. OpenGL owns mobile and the web, but they don't compete in the same category.
As for WebGL Apple intentionally disables WebGL support on iOS - except for in iAds - so game devs can't circumvent the app store. Since WebGL is needlessly restricted to the feature set of the OpenGL ES specification its usefulness is severely limited. WebGL also has many other problems such as the fact that JavaScript is slow as hell.
Yes, WebGL is disabled on iOS. It's disabled on OS X desktop too, for now. Hopefully that will change soon.
> JavaScript is slow as hell.
I wouldn't say that 67% of native speed is "slow as hell", and that's where things currently stand. Perhaps you have a specific workload in mind that happens to be slow - how did you measure?
And has very little to do with CPU speed. There are some games where CPU speed is important but there's a large subset (I'd be willing to bet 95%) of AAA games where only GPU speed is important and they run just fine on low end CPUs.
My experience with low-latency programming suggests that often the biggest cost is memory management -- garbage collection. In some cases, the GC compacter may even be limited by CPU, although usually its the collection pauses themselves which hurt the most.
There is an reason why review sites use games for CPU benchmarks. As you can see some games are indeed GPU bound. But vast majority is actually bit of both, e.g some section of it is purely CPU bound while another is purely GPU bound. So improving either component will increase FPS.
This was attempted. It failed: http://en.wikipedia.org/wiki/OpenGL#Longs_Peak_and_OpenGL_3....
This is pretty much the opposite of “design by committee”.
> To support backwards compatibility, the old state based API would still be available, but no new functionality would be exposed via the old API in later versions of OpenGL. This would have allowed legacy code bases, such as the majority of CAD products, to continue to run while other software could be written against or ported to the new API.
CAD dinosaurs would still have their old API. What was the matter, then?
While OpenGL can be full of extensions, if you ignore the extensions and stick to the base it's pretty easy to write a program that doesn't have to care what system it's on
OpenGL extensions are likewise absolutely necessary to make full use of the hardware, but the extensions mess is way worse than the range of optional OpenCL features.
So my point stands, you can generally use GL without worrying about hardware. Not so with CL.
If you're bothering to write something in OpenCL/other parallel computation framework, you probably care about that stuff.
Most importantly there is no global binding. Instead of binding one just sets kernel arguments and executes the kernel.
In principle there's no longer any reason why it has to work this way, because now we have shaders. These are a more domain-specific tool than a C API, and can thus safely present large cross-sections of graphics card functionality in a higher-level way without taking power away from the graphics programmer. So, for example, people modding Minecraft can introduce their own visual effects stages by hotloading shaders into the standard Minecraft graphics pipeline.
EDIT: I haven't talked about performance. For game developers, rendering a frame quickly is as important as having total control over the output of the rendering process. For the most part, building an API higher-level than OpenGL also means dictating a particular scene graph structure, as with OS-specific window system APIs. If the API imposes a certain way of organizing your scene graph, this can have serious impacts on your game's performance, because the scene graph traversal is optimized for one type of scene and you're using it for another. I'm not sure I'm simplifying this explanation very well, but that's the gist of it.
> these APIs are very thin abstractions over the actual assembly-level instructions sent to the graphics card
If only this were the case... The drivers end up doing quite a bit, to the point where most renderers spend most of their time waiting for the driver to return. This is part of the reason Mantle was a big deal, and why DX12 and GL5 promise to be lower level.
> In principle there's no longer any reason why it has to work this way, because now we have shaders
Shaders don't replace all the fixed function parts of the GPU, and they don't try to. Maybe someday they'll replace more of it, but there are still several fixed function stages in the rendering pipeline.
Not to mention, setting GPU state will pretty much always be completely independent from shaders, and required for many visual effects. D3D or CG FX files try to abstract this, but I don't think they're popular anymore.
> For the most part, building an API higher-level than OpenGL also means dictating a particular scene graph structure...
The general premise that any layer on top of the driver will limit on the way you structure the renderer is accurate, but scene graphs are an antipattern inside a modern renderer. Plenty of engines use them for higher level organization, but keep it far away from the renderer. All that pointer chasing murders the cache.
> Drivers should not crash the GPU or CPU, or lock up when called in undefined ways via the API
runs directly counter to this complaint:
> They will not bother to re-write their entire rendering pipeline to use super-aggressive batching, etc. like the GL community has been recently recommending to get perf up.
Error checking = higher per call overhead = slower performance.
If you think there should be a way to turn on a sort of safe-mode or something where the driver holds your hand that sounds reasonable, except for this:
> I've seen major shipped GL apps with per-frame GL errors. (Is this normal? Does the developer even know?)
In other words, the error checking the driver does to is largely ignored. Adding additional error checking at the cost of performance? That won't help at all.
Since OpenGL 3.2 > http://en.wikipedia.org/wiki/OpenGL#OpenGL_3.2 there is a strict division between core profile and compatibility profile. If you want a major simplified API just request a core context instead of a (default) compatibility context.
Thus you only drop support for computers with only Intel GPU and processor older than Sandy Brige. When I consider how many app developers drop support for older iPad/iPhone versions that are much more recent than pre-Sandy-Bridge CPUs and hardly anybody complains (the same is, of course, true on Android), I really have difficulties understanding where the problem is.
However, it does not change the fact that many of those systems are only 2.1 capable.
Autodesk's entire product line migrated to a D3D-only rendering pipeline. Why? Because D3D is the superior API.
I know many of Autodesk apps run in Linux, Mac OSX, Windows and iOS--so I'm curious. The only reference I can find is a long reply from an Autodesk Inventor developer [1] from what looks like around 2007 where OpenGL was removed form their Windows-only app (Autodesk Inventor). It sounded like his beef was with the sub-par driver support for the OpenGL spec amongst video cards and not with the API itself (which I appreciate as an issue, but is very different from this discussion about it being a poorer API).
[1] http://forums.autodesk.com/autodesk/attachments/autodesk/78/...
Nonsense! OpenGL is an evolving specification for the best-of-best. Why take away the tools that make games exceed the theoretical performance of a GPU? Removing features is unjustified if we know how to use them.
What the author needs is a wrapper and many exist. For example, Qt will let you write graphics code that runs on the desktop and mobile.
Certainly nobody would call for the end of WinAPI because thats how we wrote the other APIs!
>Removing features is unjustified if we know how to use them.
This is not the path that OpenGL has taken, as shown by all the deprecations and removals done in previous versions.