Hacker Newsnew | comments | ask | jobs | submitlogin
If you were involved in the OpenGL ES specification, you are an idiot (jwz.org)
313 points by cpeterso 666 days ago | comments


hesdeadjim 666 days ago | link

God what flamebait, how is this near the top of the front page?

When your primary argument that the ES designers were idiots is lack of immediate mode, I'm sorry, you are the idiot. These are embedded systems with highly constrained resources and that immediate mode API is horrible for a lot of reasons:

* Requires tons of driver calls.

* Stupidly hard to optimize on the driver side when you have no idea just how many vertices or other per-vertex data are to follow your call to glBegin.

* Trivial to replace with a much better, and much, much higher performing vertex representation either through vertex buffer objects or simple calls to glVertexPointer/etc.

* Teaches beginners the Wrong Way of doing things -- you won't use this API for anything beyond a toy program as the last thing you would do is load an exported mesh from Max or Maya and then iterate through every vertex.

Having learned OpenGL initially with the ES 1.1/2.0 spec, then transitioning back to the desktop version, I couldn't believe how bloated the API had gotten. There is a reason they want to deprecate most of it and move to a spec that is similar to ES in its simplicity.

-----

ecaron 666 days ago | link

> God what flamebait, how is this near the top of the front page?

Because the source is widely respected and has an amazing demonstrated grasp of what good programming involves.

-----

roel_v 666 days ago | link

Eh, not any more. JWZ is a has-been, who admittedly did good things back in the 90's, but who has lost touch with the industry when he became a hobby coder. This post is a clear demonstration of that - if he knew even a little bit what he was talking about, he wouldn't make the outrageous claims he does. But no, he just want to hang on to his toys he wrote 15 years ago and have them work with just a recompile on platforms that don't even remotely resemble the platforms he wrote them for back then. That's just absurd. And yes, I too complain (loudly) when I have to change code to accommodate changes in the platform (like how VS12 doesn't support WinXP) but in the end, deep down, I recognize that that's just how it has to go, and so should somebody who knows (or should know) much better than me, like JWZ.

-----

seclorum 666 days ago | link

That's just absurd.

Its not absurd at all. He's got a massive collection of amazing GL-based screensavers that a LOT of people have learned graphics programming from, over the years. There are still contributions being made to this collection in 2012, and there have been consistent additions to the collection since the very early 90's. This is no toy collection.

Fact is a lot of great OpenGL code could run on the iPad today, if only the false ideology of cutting 'archaic things' out of the ES profiles wasn't getting in the way. There are plenty of opportunities for OpenGL apps from decades ago to be re-targetted to the new platforms, if only for this problem - and jwz is right to point it out.

-----

roel_v 666 days ago | link

Anyone learning OpenGL from code as young as 5 years old (i.e., all fixed-pipeline code) is getting shafted because what they learn is so out of touch with the state of the art in graphics technology. Just like for the Nehe tutorials that whole generations have been brought up on. That's the whole point here, 3d graphics has moved on, and everybody working in it should, too; of course, as with anything, there are always grumpy greybeards who feel that their way of doing things is Good Enough For Them, and therefore should be supported indefinitely.

The arguments on why fixed-pipeline OpenGL should be deprecated have been re-hashed several times convincingly in this thread, I don't have to repeat them here. I don't quite see why the state of the art in graphics should be held back because some people want to see spinning teapots on their iPads without having to learn something new. You seem to be implying that programs written in the past can't be made to work on new platforms; while it's true that it would need changes to the code, please show me the decades-old program in Objective C or Java you mention that you'd like to see working on your iPad without having to change the code.

-----

seclorum 666 days ago | link

I'd love to have Electrogig 3DGO on my iPad.

-----

roel_v 665 days ago | link

I hadn't heard of it, but a quick google shows that it's (or rather, was) a closed-source 3d modeler that was discontinued in the late 1990's. That is another situation than the one under discussion; API backwards compatibility doesn't even apply to that product, that product would require a way to run native-code binaries, written for (presumably) Windows (or otherwise, some Unixes), unmodified on the iPad.

The point of my last sentence was that it's impossible, because that long ago Java, iPads, Cocoa etc. didn't even exist. For somebody who wants to port a C++ codebase from those days to a mobile platform, having to re-do the 3d rendering (which is only a very small part of any well-engineered large application anyway) in a programmable pipeline is the least of his worries.

-----

greggman 666 days ago | link

Yes but in this case he's an idiot. Try asking Carmack. Any GPU programmer knows GL 1.x was utter crap. Good riddance.

-----

astrodust 666 days ago | link

jwz, if you've been following him, is inherently pragmatic. He's a follower of the philosophy that the computer, and by extension the frameworks and languages to program it, should be subservient to the programmer. They shouldn't tell you how to live your life or behave like a stubborn mule when, for whatever well intentioned reason, people decided to overhaul the spec everyone depended on.

I think his argument is that OpenGL ES should have had an "optimal" mode, where performance is best using the newer calls, and "compatible" mode, where if you don't care about performance and just want to port, you can get by. This appears to be what the jwzgl layer does.

-----

soup10 666 days ago | link

Essentially he's just whining that porting his project is difficult because the API doesn't have the more beginner friendly(but inefficient) drawing calls that used to be there. OpenGL ES is not designed to be beginner friendly, it's meant to give low-level access for high performance graphics. It's perfectly reasonable to use an abstraction layer on top of that for simple drawing, it's not that hard, and a quick google would probably find many projects that have done so.

Personally if your going for simple, and not performance, there are much better ways to design the api than glBegin(). So all those calls are the worst of both worlds, awkward, and slow.

-----

greggman 666 days ago | link

OpenGL ES is for "embedded systems" which basically means phones. That means inefficient programming drains the battery. Sure if jwz want's to punish his user's I guess that's his prerogative but it seems like a good decision to provide an API that discourages bad practices.

Basically they decided to get rid of the cruft. OpenGL 1.x was designed in 1992? GPUs fundamentally changed in the mid 2000s and the decisions made for OpenGL 1.x no longer fit.

If you want 1.1 go contribute to this project. http://code.google.com/p/gles2-bc/

-----

astrodust 665 days ago | link

The iPad graphics subsystem absolutely destroys anything around when the OpenGL spec was released and many of these screen-savers were designed against hardware that's unbelievably slow compared to an iPad.

He's not making a game that's going to drain the battery in ten seconds flat, he's porting screensavers made in the late 1990s that were never heavy-duty to start with.

-----

msbarnett 665 days ago | link

Sure. But OpenGL ES was not designed for the iPad. The decision to reject immediate mode was made in 2003, for the mobile devices of that time. And it is used in the industry for devices much less powerful than the iPad, even today.

It continues to be a popular choice for anything like the iPad, where there is no legacy software based on regular OpenGL, because it is a much cleaner and much easier to implement stack, and because if you are writing new software you should never be using all of that old deprecated cruft anyways.

-----

zurn 665 days ago | link

First rule of optimization still applies to these battery-operated GHz/GB machines. If it's not a bottleneck, don't waste complexity and time on it.

-----

raverbashing 666 days ago | link

Yes

GL 1.x is good for GLXGears and not that much more

(Yes, even though some games used it, etc, still...)

-----

anonymous 666 days ago | link

> These are embedded systems with highly constrained resources Gigahertz quadcores with several gigabytes of RAM is "constrained resources" nowadays? I agree with you though - it's flamebait. But it's also true.

-----

potkor 666 days ago | link

These "embedded systems with highly constrained resources" are machines with 512MB+ of memory and monster CPU/GPUs. It's perfectly OK to write code for them that you haven't bled over to optimize the hell out of.

And JWZ just showed you don't need "tons of driver calls" unless you mean simple function calls that don't cross the kernel boundary.

-----

hermanhermitage 666 days ago | link

OpenGL ES is not designed to be OpenGL.

It has a different set of constraints. The point is to prune back the API for small devices - NOT - to make make migration of legacy code simple.

For sure it would be nice if it came with a client side library to emulate OpenGL to assist in migration where people dont care about foot print size or perf.

JWZ is a very smart guy and I respect his opinion, but he is coming from a narrow viewpoint and not considering the wider implications.

In my experience, backwards compatible APIs and languages are what makes development a pain going forward. This is not to say backwards compatibility should not be provided in some form - but ejecting it from the core is a sane decision.

Otherwise APIs and languages expand at an unfathomable rate. Imagine if every API or language you ever used had features both added and removed over time to make it a better language. Javascript without the bad parts for example.

An incremental only approach to design is non-design in my view.

Evolution both promotes and retires ideas.

-----

MrFoof 666 days ago | link

>It has a different set of constraints. The point is to prune back the API for small devices

I came here to say something along these lines, but right now I'm limited on time so I don't have time to go into specific examples.

In OpenGL, there might be 5 ways to do something. Three of them are very much suboptimal, one way worked but was incredibly kludgy to write, and one was performant and pretty clean.

With OpenGL ES, they got rid of all the suboptimal and kludgy methods. The benefit today is if you write an OpenGL ES application, porting it to OpenGL nowadays is pretty easy. The other way around? Yes, that can be tremendously difficult. Honestly, I wish a lot more in OpenGL 3.x and 4.x was deprecated. Working with ES and the reduced extension hell is a big step up from the mess the full OpenGL API can be.

-----

CamperBob2 666 days ago | link

The point is to prune back the API for small devices

I don't disagree with the general sentiment that it was time to clean out the cruft in OpenGL, but I find this part of the argument to be a bit humorous. These "small, constrained devices" we're talking about are probably 10x faster than a goddamned Reality Engine.

I tend to agree that the API should have been renamed entirely once it was pared down this far, as 3Dfx did when they created Glide.

-----

msbarnett 665 days ago | link

> I don't disagree with the general sentiment that it was time to clean out the cruft in OpenGL, but I find this part of the argument to be a bit humorous. These "small, constrained devices" we're talking about are probably 10x faster than a goddamned Reality Engine.

OpenGL ES 1.0 was released in early 2003, IIRC. The decision to exclude Immediate Mode from OpenGL ES 1.0 was made sometime prior to that.

2002-2003's typical mobile hardware was pretty damn weak, in particular in the areas of CPU cycles and memory bandwidth, which is where Immediate Mode really bites you in the ass. And the RAM/ROM sizes on most of these devices were small enough that every byte you could shave off the driver was a win for application writers, so there was little desire on the part of mobile graphic hardware vendors to spend memory budget on redundant features that an application could rebuild on top of lower level primitives if they so chose.

-----

katabatic 666 days ago | link

Core APIs and languages do not expand at an "unfathomable rate". How long as the Berkeley sockets API been with us? TCP/IP? Twos-complement arithmetic? Do you honestly think that those are going to go away for the sake of some vaguely hand-waved "wider implications" and "idea promotion"?

OpenGL has been, like it or not, the only open, widely-adopted, non-proprietary 3D graphics API around for quite some time now. Enabling it on mobile devices wasn't exactly a sea-change requiring tossing all compatibility with the past in order to make progress (especially not as mobile GPUs continue to get more powerful).

jwz's point was that this could have very simply been included as an optional compatibility layer, which he then went and did.

[edited to put in the "not" in the first sentence that my fingers skipped over, which kinda changed the whole argument]

-----

Ralith 666 days ago | link

But OpenGL ES does not enable OpenGL on mobile devices; that's the entire point of its existence. It enables OpenGL ES, which is intentionally designed to be a simplified subset.

If mobile device manufacturers feel that full-on OpenGL is appropriate for their device, then they are free to implement full-on OpenGL. JWZ should be complaining to the manufacturer, not the spec authors.

I believe that on modern hardware, OpenGL proper is simply OpenGL ES style features (and then some) with a software compatibility layer.

-----

jes5199 666 days ago | link

> In my experience, backwards compatible APIs and languages are what makes development a pain going forward

That's the exact opposite of my experience! Libraries that are constantly changing their APIs produce the vast majority of my work.

-----

cpeterso 666 days ago | link

I think hermanhermitage meant that backwards compatibility makes development painful for the library developer.

-----

StavrosK 666 days ago | link

I'm not knowledgeable about OpenGL at all, but how hard would it be to write a compatibility layer so older apps continue to work? It could be released as a third party shim.

-----

greggman 666 days ago | link

http://code.google.com/p/gles2-bc/

-----

drivebyacct2 666 days ago | link

Isn't that precisely what he did here? (note, I know nothing about nothing when it comes to graphics/OpenGL stuff)

-----

mey 666 days ago | link

I believe the authors original point is why not provide the shim support as part of OpenGL ES in the first place? Stick a big red sticker on it saying here be dragons, but it's obviously not an impossible task.

The funny thing is, his shim is actually useful for speeding up code (in theory, this may already be done) on normal OpenGL. (For anything using these interfaces)

-----

hermanhermitage 666 days ago | link

Disclaimer: I've dabbled as a driver writer in a past life - but not OpenGL ES.

The problem is a 100% compatibility layer is not necessarily easy nor valuable. The makers of OpenGL ES don't want a lifetime of maintaining someone elses problem. Also there is a line where you cross and you lose hardware acceleration and the mapping breaks down.

Their charter is to make a new lightweight API that meets the needs of device manufacturers and low level app developers. As soon as they adopt 100% compatability at their core or even offering an additional adapation layer they will be taking time and effort from their focus.

In this instance any OpenGL shim is an Apple responsibility as they are the SDK and environment provider. Apple and Videologic need to nut that one out themselves.

As to a shim speeding up code its essentially comes down to any impedance mismatch that may occur between an application writer and the API. This is identical to buffered versus non buffered IO and whose responsibility is it to filter idempotent operations.

When you look at a typical call stack. You'll see an application (potentially caching and filtering state), calling a library shim (potentially caching and filtering state), queuing and batching calls to a device driver (potentially caching and filtering state), dispatching to a management layer (potentially caching and filtering state), and so on, eventually getting to a graphics card processor potentially caching and filtering state and finally to a pipeline or set of functional blocks (which may have some idempotent de-duping as well).

Again how this is communicated to the developer or structured is an issue of the platform provider.

Apple can choose to say we optimize nothing (ie add no fat, waste no extra cycles) its up to you to dispatch minimal state changes, or we optimize a,b & c... - don't repeat this work, but maybe add optimizations for d, e &f... Thats something they need to document and advise on for their platform. Its not part of most standards.

-----

rys 666 days ago | link

Warm fuzzies for calling us Videologic instead of Imagination or PowerVR. Your description of the layers between an application and execution on the graphics core on iOS is pretty good. There's nothing between driver and hardware though.

As for why OpenGL ES is different to OpenGL, it's documented in myriad places. The resulting API might be bad in many ways, but it was never designed to allow easy porting of OpenGL (at the same generational level). It was designed to be small, efficient and not bloated, to allow for small, less complicated drivers and execution on resource-constrained platforms. It mostly succeeds.

-----

hermanhermitage 666 days ago | link

Long live mgl/sgl! The mention about hardware dedupe/filtering was more a hat tip to culling sub pixel triangles and early culling of obscured primitives that seems to happen on many chips these days :)

-----

rys 666 days ago | link

We tip our hat right back! It happens to be pixel-perfect for us in this context, and it's a large part of why we draw so efficiently. Oh, and I still have a working m3D-based system that plays SGL games under DOS!

-----

lnanek2 666 days ago | link

There actually are PDFs out there for the various GPU IPs on how to write best for them (Adreno, PowerVR, etc.). Sometimes they even disagree, so using triangle strips with degenerate triangles to connect separate portions can be better than using all separate triangles on another, depending on their optimizations. Apple also has recommendations: http://developer.apple.com/library/ios/#documentation/3DDraw...

Although I don't recall off hand if any of them have mentioned sorting commands by state and deduping, which I suppose is one of the most basic optimizations for OpenGL * APIs.

-----

msbarnett 666 days ago | link

> I believe the authors original point is why not provide the shim support as part of OpenGL ES in the first place?

OpenGL ES isn't intended to be the same API as OpenGL, despite the shared "OpenGL" in the name. It was a new API created with the idea that it would be based on the lessons learned from OpenGL, but be completely modern and not bogged down with the need for embedded driver authors to waste time implementing tons of legacy crap calls that nobody in their right mind should have been using for the last 10 years anyways. It uses the opportunity afforded by building a new API for a different target environment from normal OpenGL as an excuse to make all of the breaking changes that everybody would love to make in regular OpenGL if only there weren't so much legacy software that depended on the presence of deprecated, decade out-of-date practices.

That's why OpenGL ES never contained all of the immediate mode cruft from OpenGL, and OpenGL ES 2.0 throws out the fixed-function pipeline altogether.

Why didn't the Kronos group define a shim to begin with? When your goal is to build a new API that throws out all of the shit legacy calls that are a bunch of pain to support for no benefit, what do you gain by then re-implementing all of those shit legacy calls again? Any number of people have built a fake immediate mode on top of OpenGL ES over the years; there's nothing new about what jwz did here. If you really want to write OpenGL ES as if it's 1998's OpenGL, there's nothing stoping you from doing so.

-----

StavrosK 666 days ago | link

It sounds like it. He could just package it up a bit better, release it and render this whole discussion moot.

-----

kennywinker 666 days ago | link

And OpenGL ES only existed for 5 years before someone came along as was pissed off enough to do it!

Edit: 5 years was OpenGL ES 2.0, can't seem to find a date for OpenGL ES 1.0, but suffice to say it was around for quite some time.

-----

msbarnett 666 days ago | link

> And OpenGL ES only existed for 5 years before someone came along as was pissed off enough to do it!

Eh, he's hardly the first guy to do this. Appendix D of my copy of Graphics Shaders: Theory and Practice contains a simple reimplementation of Immediate Mode on top of VBOs for people with a burning desire to prototype their code as if it were 1998 again.

And in reality, in most modern OpenGL (non-ES) implementations, the actual hardware-backed bits basically look like the OpenGL ES API, and all of the legacy cruft is implemented in exactly the same kind of software shim.

-----

mcbridematt 666 days ago | link

Now that smartphones and tablets have respectable GPUs in them, is there any reason why they shouldn't implement the full OpenGL spec?

-----

msbarnett 666 days ago | link

> Now that smartphones and tablets have respectable GPUs in them, is there any reason why they shouldn't implement the full OpenGL spec?

To what benefit?

OpenGL ES is basically OpenGL minus all of the bits you really really should have stopped using over a decade ago. Originally all of that crap was culled out because it was only realistic to write new software for such resource constrained devices anyways, so why burden driver authors and hardware with the need to support crap that should never be used anyways?

Now that mobile device CPU/GPUs are powerful enough to start being appealing as targets for porting OpenGL-based applications, I think the proper response is less "great, slather back on all of the deprecated legacy cruft from the desktop version of OpenGL" and more "for the love of god update your rendering pipeline to reflect the last 15 years of progress".

-----

zokier 666 days ago | link

Afaik OpenGL ES 2.0 is only a subset of OpenGL 2.0, and doesn't have anything from latter versions (3.x and 4.x). Fixed-function pipeline was removed in OpenGL 3.1 (core). See eg OSX implementation of OpenGL.

So OpenGL ES is not OpenGL minus legacy bits. It was that back in the day, but today it is far smaller subset. Implementing OpenGL > 3.0 would not require implementing fixed-function pipeline, and would benefit programmers using the latest and greatest features.

-----

mattrobertso 666 days ago | link

I thought the issue with immediate mode which prevented its inclusion (in ES) was that immediate mode is very inefficient for the CPU, resulting in increased battery drain on smartphones and tablets.

-----

kevingadd 666 days ago | link

All rendering is in some capacity incremental. Sometimes you keep that (incrementally constructed) list of vertices around, of course.

If you look at the old immediate mode API, fundamentally, you're just passing in some floats that it copies into a buffer. This is not an expensive thing to do. It's not free, sure, but CPUs aren't bad at it. It's just some overhead compared to if you were to hand an entire buffer (in a known format) full of floats to the GPU at once. Some extra function calls, etc. If your app is only drawing a few thousand vertices, the overhead difference here is trivial... and if your app is drawing a million vertices, you won't be using immediate mode anyway.

-----

greggman 666 days ago | link

Modern GPUs have to put the vertices in vram before they can render them.

That means immediate mode emulation is effectively this

    everyframe:
      a) copy all vertices from user code to some cpu buffer
      b) at draw time, copy cpu buffer to vram
      c) ask GPU to draw
steps A and B are very expensive CPU wise as well as waste memory.

vs OpenGL ES 2.0

    init time:
       put vertices in vram

    everyframe:
       ask GPU to draw

-----

ktizo 666 days ago | link

An incremental only approach to design is non-design in my view.

Nearly all design is incremental. That's how design works. That's partly why chairs are still recognizably chairs, and other useful stuff like that.

-----

hermanhermitage 666 days ago | link

Quite true. But there is another word there "only".

-----

ChuckMcM 666 days ago | link

I don't think jwz would have had a problem with it if you called it EmbeddedGL or PhoneGL instead of trading on the name of OpenGL. Like jwz I thought "Oh its OpenGL I've got code already that does most of what I want." only to find none of that code worked.

-----

SoftwareMaven 666 days ago | link

Were people really surprised that Java ME, Java SE and Java EE were different APIs around the same core idea of write once, run everywhere?

-----

marshray 666 days ago | link

So this whole rant was just about the name having a common substring of three or more characters?

I hope nobody tells JWZ what Linux was supposed to sound like.

-----

ktizo 666 days ago | link

true. I think I read your meaning wrong anyway.

-----

dkarl 666 days ago | link

I don't think xscreensaver is a good example of valuable OpenGL 1.3 code that users want running on the iPhone. I think a person ought to have such an example before they start calling people idiots. Not to say that porting xscreensaver to the iPhone isn't cool, but it's only cool because it is anachronistic and whimsically impractical, like playing GameBoy games in a vintage arcade chassis in 2012.

There are a few things I couldn't figure out how to implement:

This after a year of percolation and three days (plus a few hours) of intense work by jwz. Given jwz's reputation as an insanely good programmer, I think this says a lot. As in, there's a nontrivial amount of work to do to claim near-compatibility with OpenGL 1.3, and an undetermined amount more work to claim true compatibility. Plus there may be more functionality from 1.4 and 1.5 to claim backwards compatibility with all of OpenGL 1.x. And all that to grant a (deservedly) dead desktop API new life on a mobile platform. No wonder they didn't bother.

-----

forgottenpaswrd 666 days ago | link

Maybe the idiot is jwz.

There was a change in the technology that needed a change in the API. Not a single GPU use a fixed pipeline anymore, so the API needs to change.

I see OpenGL as a testing platform that learned by trowing to the wall and learning what sticks. Companies create extensions and if people find it useful they became part of the language, but in any API there is a need for removing what is not used anymore or can be done much more efficient with new ways.

Maintaining code takes a lot of resources and is a pain in the ass to program, I can tell you(you have to emulate a lot of things that do not exist anymore, including BUGS or HACKS).

I could understand not being Apple extreme here, e.g look at the Apple TV and you only see new digital ports, but the other extreme, don't touch anything for 20 years because it works is equally non sense..

I remember a brand new computer that was hanged 5 seconds on the start up by a 1.4M floppy disk because the people who assembled the computer were afraid to remove the thing. I had to remove the thing, left a horrible hole and I discovered the machine had the floppy check hardwired in the BIOS!!!

You buy a computer today and it has parallel, serial and PS2 ports with an outdated BIOS with 1981 timings they can't change so they don't "break legacy standards".

You buy a computer in 2012 with a 1900x1080 pixels and the first thing you see is a horrible black screen with fuzzy letters.

Non sense. openGL needs to be way more clean that what it is now, where it is impossible to remove anything because some company of the consortium find the feature "essential" because they have some legacy code they are too lazy to update.

-----

marshray 666 days ago | link

It's not like there's this massive base of OpenGL code just waiting to be ported to embedded devices if there were just a few more API calls. Yes, there's glxgears, screensavers, and handful of open source games. You could probably get some old CAD programs to run on your Android.

But if we compare the massive number of newly written OpenGL ES applications to all the old OpenGL 1.x fixed pipeline apps, the latter seem insignificant.

As he so ably demonstrates, it's just not that hard to port the older apps either. This "All you engineers are idiots because I had to work THREE WHOLE DAYS to port this 20 year old code to an iPhone" just sounds childish and silly.

The OpenGL board made the right decision for ES.

-----

semanticist 666 days ago | link

Except he didn't port his code to OpenGL ES - he ported the missing API from OpenGL 1.3 to OpenGL ES.

If it takes one developer three days to implement the missing API, then perhaps it suggests that this API wasn't in any way damaging to the new system and could have been left in place originally?

-----

msbarnett 666 days ago | link

It didn't take him three days to port all of the cruft from OpenGL 1.3 to Open GL ES; it took him three days to port the precise calls and precise semantics he relied upon in OpenGL 1.3 to OpenGL ES, and even then he punted on some of it.

The latter is a far, far cry from the former. The former is basically what a modern OpenGL (non-ES) driver does to support all of the legacy cruft on modern hardware. Recall that the OpenGL API is an API for a state machine. All of those layers of cruft built up over the years have incredibly arcane state interactions, are a bitch to support, and are why modern OpenGL (non-ES) drivers have gotten rather quite bloated.

Edit: to tackle the second part of your comment:

> perhaps it suggests that this API wasn't in any way damaging to the new system and could have been left in place originally?

The Immediate Mode calls he complains about not being there? They were "removed" (never introduced) way back in OpenGL ES 1.0, which IIRC originally debuted in 2003.

It's a pretty big stretch to argue that because reimplementing Immediate Mode on top of OpenGL ES doesn't have a crushing performance penalty on 2012's iPhone, it wouldn't have been a problem on what passed for mobile hardware back in 2003.

(which is ignoring the fact that even if the performance back then wouldn't have been garbage, taking the opportunity to make breaking changes and throw out cruft for an API that wasn't expected to host legacy apps was absolutely the right move)

-----

marshray 666 days ago | link

* It costs money to document.

* It costs money to implement. Three days for a lone coder, much more than that for a careful consistent development process.

* It costs money to develop regression and validation tests.

* It costs money to test, including collecting all the different hardware it needs to be tested on.

* It costs money to fix bugs in it.

* It costs money to answer questions from developers about it.

* These costs are multiplied by every future version that will continue to support it.

* These costs are multiplied by the many vendors that will be required to implement it.

* Some of these costs are multiplied by every language that will support bindings to the API.

* It costs code space in embedded devices.

* It costs as much as a vendor wants to spend trying to make it perform as fast as possible.

* It costs conceptual complexity in developers' heads.

* It costs developers when they inadvertently do things the old inefficient way.

* It costs reputation when somebody compares benchmarks of your product using the old inefficient way against another vendor's product using the new recommended way.

* Requirements to continually support it at the same level of performance constrain your choices when developing new hardware.

* Sometimes it costs precious die space which could be better used for other things.

* The inefficiency sometimes increases power consumption and reduces battery life.

* Users are disappointed if every version of new hardware doesn't run the old inefficient code even faster than the previous version.

So if it doesn't have a real need to be there in ES 1.0 then, yes, it is actively damaging and should be thrown out in the rewrite.

-----

bigiain 666 days ago | link

While that's all true - it completely ignores the externalities. It cost Jamie 3 or 4 attempts and eventually 3 days work to get his unbroken code running on the new OpenGL version. What's the multiplier needed to account for the cost this change incurred for all the other developers who wrote code using OpenGL before ES?

Sure, maintaining backwards compatibility is costly for a project like OpenGL. But if you choose _not_ to maintain backwards compatibility, for whatever reason, and then someone shows that your reasoning is bogus by reimplementing the old API calls in 3 days, you should expect to get called "idiots". (And you then should either be sure enough in your convictions that you know jwz is wrong, or take it on the chin and say "Hey, we fucked _that_ one up. Mind if we include your code in our next release?")

-----

msbarnett 665 days ago | link

> While that's all true - it completely ignores the externalities. It cost Jamie 3 or 4 attempts and eventually 3 days work to get his unbroken code running on the new OpenGL version. What's the multiplier needed to account for the cost this change incurred for all the other developers who wrote code using OpenGL before ES?

This is ignoring an awful lot of reality. Like, that OpenGL isn't a project that ships one software stack, but a standard managed by a group and voluntarily implemented by graphics vendors.

The Khronos group exists to negotiate between vendors and create a spec they're willing to implement, not to dictate to them a spec they hate and will ignore. There was a near riot when the OpenGL (non-ES) 3.0 was announced; many vendors were seriously pissed off that it didn't drop Immediate Mode and the the fixed pipeline and that they had to sink enormous amounts of time into writing and maintaining a compatibility layer on top of modern GPUs for shit that had been deprecated for damn near a decade. That meant not just writing an Immediate Mode shim for a tiny subset of OpenGL 1.3 like JWZ (and like countless other have done in the past), but doing shit like generating shaders on the fly based on the current state of the emulated fixed function pipeline, and making sure to cover all of the bizarre corner case interactions between all of that old fixed function garbage and threading and any new calls the program happened to mix in.

Vendors were ready to walk away from OpenGL over this. That's why the OpenGL 3.1 spec dropped the fixed pipeline like a hot potato and doesn't require that vendors ship a compatibility profile for the old crap.

Now, what if, back in 2003 when the decision to not include this stuff in OpenGL ES 1.0 was made, they'd released a spec requiring mobile vendors to do the same thing? What would the cost to JWZ and his project, and all other developers who wrote OpenGL before ES, have been if the mobile vendors had collectively told Khronos to fuck off? If OpenGL ES didn't even exist as a target for a shim, because there was no way in hell mobile vendors were going to ship a multi-meg driver that had to generate code on the fly, on the off chance anyone ever wanted to ship AutoCAD for hardware that barely had enough RAM to fit the driver?

Because there was certainly no guarantee, at the time, that OpenGL ES was going to become the standard for mobile graphics. It happened only because the standard that was proposed was something that the vendors were willing to ship.

> Sure, maintaining backwards compatibility is costly for a project like OpenGL. But if you choose _not_ to maintain backwards compatibility, for whatever reason, and then someone shows that your reasoning is bogus by reimplementing the old API calls in 3 days, you should expect to get called "idiots". (And you then should either be sure enough in your convictions that you know jwz is wrong, or take it on the chin and say "Hey, we fucked _that_ one up. Mind if we include your code in our next release?")

Oh come off it. He didn't reimplement ALL of OpenGL in 3 days. He reimplemented the tiny subset of calls, with the precise semantics (and only the precise semantics) his program needed, in 3 days. That's a far cry from shipping the entire behemoth that is a fully back-compatible OpenGL stack. And he's not the first guy to do this, or the 5th. I've got books on the shelf behind me with small Immediate Mode shims in their appendixes for people who want to do it "the old way". I've seen code to do it in forums and in repos. It's dead easy.

The Khronos group doesn't see this shit and think "damn, we fucked up". They think "Good. We gave vendors a decently small spec that they were willing to implement, allowing OpenGL ES to become the standard in mobile graphics, but we still managed to base it on well-chosen primatives that people like JWZ can use to build higher-level interfaces around if they choose".

-----

marshray 665 days ago | link

This is a good question, and if you look a few posts up I started this comment tree by addressing it:

> if we compare the massive number of newly written OpenGL ES applications to all the old OpenGL 1.x fixed pipeline apps, the latter seem insignificant.

It was a design judgment they made and I think it was the right one.

> by reimplementing the old API calls in 3 days

JWZ did not produce a complete production-quality set of OpenGL 1.x compatibility APIs in 3 days. I'm going to guess without looking at his code that he didn't even write regression tests for the calls that he did implement.

What JWZ did was 3 days of possibly great coding, but that's only a tiny part of what needs to be done to ship new APIs in something like OpenGL.

-----

marshray 664 days ago | link

> What's the multiplier needed to account for the cost this change incurred for all the other developers who wrote code using OpenGL before ES?

Let me ask you that - please list as many examples as you can think of of code written for OpenGL 1.x that would make sense to port to embedded devices.

I'll kick off the list:

* xscreensavers ...

-----

greggman 666 days ago | link

He didn't implement OpenGL 1.3. He ported an OpenGL 1.3 app to OpenGL ES 2.0. There's a HUGE difference.

-----

semanticist 666 days ago | link

He ported the OpenGL 1.3 app to OpenGL ES by implementing the missing parts of the API that he needed inside the OPenGL ES API (albeit, as some people have pointed out, imperfectly).

That is not the same as rewriting an app to conform to the new API. There is, as you say, a HUGE difference.

-----

retrogradeorbit 666 days ago | link

And lets not forget he's also unwilling to help people out by uploading his OpenGL wrapper to github (or by extension any revision control system).

http://www.jwz.org/blog/2012/06/i-have-ported-xscreensaver-t...

-----

bzbarsky 666 days ago | link

The source is available in http://www.jwz.org/xscreensaver/xscreensaver-5.16.tar.gz and he mentions that in his blog post.

How much more help are you expecting him to provide? Why would it be any more "helpful" for him to put it in some revision control system instead of just posting the source?

-----

retrogradeorbit 666 days ago | link

I meant the OpenGL wrapper part, not the entire xscreensaver code base. It's kind of hard to fork a tarball.

-----

bzbarsky 664 days ago | link

How hard is it to untar, take the header and do whatever you want with it (including putting it on github if you want)?

It's definitely a lower barrier to entry than requiring people to create a github account!

Edit: the point being, that it's not just "in the tarball": it's in a specific header file, and the blog post says which exact header file you want.

-----

gioele 665 days ago | link

That is exactly what mercurial users say about code distributed on github. :)

Please respect the author's right to decide how to distribute his code.

-----

cma 666 days ago | link

the exact same criticism applies to you. why haven't you posted it to github yet?

-----

retrogradeorbit 666 days ago | link

Cause I don't care one bit. Unlike jwz who seems to care a hell of a lot.

-----

malachismith 666 days ago | link

You kind of miss the point. This is a philosophical argument ILLUSTRATED through OpenGL and a port. To quote, "thou shalt not break working code"

-----

marshray 666 days ago | link

No, I understand that point. I just don't agree with it in this case.

* "thou shalt not break working code". That's not some Universal Code of Software Engineering, that's just something he made up.

* No one in their right mind would expect you could port 20 year old C using OpenGL 1.x code to an iPhone with no effort.

* There are plenty of reasons APIs can benefit from breaking changes. Security fixes, major architectural improvements, platform porting, even general evolution and modernization. The question is always one of cost/benefit, relative pain vs relative gain.

* Sorry JWZ, but your X screensaver project is actually not an overriding concern driving the evolution of OpenGL ES.

* I didn't mention it again because so many other have pointed this out, but this isn't even the same API. OpenGL ES is not the same thing as OpenGL 1.x.

* Changing the major version number is a common and accepted way to indicate breaking changes are present in an API. The OpenGL board went even farther and gave it a different name and a different versioning scheme specifically because it is different.

-----

kevinpet 666 days ago | link

"Sorry JWZ, but your X screensaver project is actually not an overriding concern driving the evolution of OpenGL ES."

Seriously, if you think that's a valid response, then you did not understand his point. Repeating something does not make it any more valid an argument.

-----

marshray 665 days ago | link

OK I re-read his post. I think I understand his point. He has a something of a valid point, but what he is raising are considerations, not overriding principles.

If he wants to write his code by treating these as "thou shalt not" type laws, that's fine. He can criticize others for not following the same principles. But calling a bunch of top graphics engineers "idiots" because they looked at a vastly different engineering problem with different priorities and arrived at a different design is rude and ignorant and it reflects poorly on JWZ.

JWZ makes this statement: "Your users have code that works."

He is simply wrong about this.

* No one had working OpenGL ES code before OpenGL ES was standardized. This is by definition and one cannot argue the definition of OpenGL ES with the OpenGL standardization body itself.

* Even if you wanted to accept the mistake of thinking of the existing OpenGL 1.x codebase was supposed to be forwards compatible with ES, it's not true in the main. The amount of existing OpenGL 1.x that could plausibly benefit from being ported to embedded devices is insignificant. Seriously, JWZ may have just ported most of it.

This is what I mean by "X screensaver project is actually not an overriding concern driving the evolution of OpenGL ES."

JWZ seems to think that his principles of software engineering are the only correct way to look at it. He goes so far as to say "If you don't agree with that, then please, get out of the software industry right now. Find another line of work. Please."

To support such absolute claims and broad sweeping statements he uses a toy porting project that takes three days. The vendors who participate in the OpenGL ARB are concerned with projects that take 3 years and APIs that persist for more than 20! Don't you think they actually might know a thing or two about APIs and engineering them for software? Don't you think they might know extremely well what the costs of failed backwards compatibility are?

But that's OK, everybody scratches their head for a bit trying to sort out the different flavors of graphics APIs. Even single-vendor Direc3D has similar issues. If this is the most confusing thing about OpenGL to him and he can do something useful with OpenGL ES in his first three days of messing with it, he is a really really smart guy.

-----

debacle 666 days ago | link

If your architectures are completely different, you're going to have to break some fucking code. That's just the way it is.

-----

justinhj 666 days ago | link

The article showed the opposite. That there was no need to break existing code.

-----

msbarnett 666 days ago | link

It showed that some existing code with a shim containing a reimplementation of a small subset of OpenGL 1.3 could be made to run acceptably fast on a rather beefy example of 2012's mobile hardware.

It certainly did not show that there was no need to exclude those calls back in 2003 when they were originally not included in OpenGL ES.

-----

jbrechtel 666 days ago | link

Wasn't there? There were a number of functions he didn't port. He ended up with a subset of OpenGL 1.3. Maybe that subset wasn't worth the effort?

-----

marshray 666 days ago | link

That's just what OpenGL needs right?

Yet another incomplete ad-hoc extended subset of OpenGL 1.x functionality lacking documentation, regression and performance tests, a stable and committed team of maintainers, ...

-----

rphlx 666 days ago | link

That is a noble goal, but it's one of hundreds of often-conflicting noble goals. It's not inherently wrong to design a toaster that fails to work as a refrigerator.

-----

quux 666 days ago | link

:) Back in 2008 I helped JWZ port daliclock to the iPhone and once that was working I proposed a port of xscreensaver. He couldn't imagine ever wanting screensavers on an iPhone at the time. Guess he changed his mind.

I also was the one that opened his eyes to the differences between OpenGL and OpenGL ES it seems. I apologize.

-----

SeanLuke 666 days ago | link

re: your username. Like retired basketball jerseys, shouldn't "quux" be reserved for Guy Steele?

-----

quux 666 days ago | link

Hmm, I didn't know the he uses quux too. I claim independent discovery.

-----

SeanLuke 666 days ago | link

Sure that's fair enough, but still, it's a bit like using Woz as a username...

-----

exDM69 665 days ago | link

disclaimer: I write OpenGL ES implementations for living. I occasionally deal with some of the guys writing (parts of) the GL specs.

This article is a load of bollocks. It actually isn't the first article I read that complains about the removal of immediate mode in GLES. This article, like the others I've read, leaves me with the impression that the author is rather clueless.

The article essentially complains that a feature from a 20 year old API should have been included in an API designed 10 years ago. The glBegin/glEnd API is a horrible mistake from the start and it should have never existed. It's a good thing it's removed from the GLES API. OpenGL 1.x and GLES 1.x are both deprecated, more than 10 years old and should not be used any more. In any case, he's complaining about mistakes(?) made more than 10 years ago.

One major flaw in jwz's reasoning is that something was removed. Immediate mode was indeed removed from the spec but an implementation of GLES w/ immediate mode never existed. It was dropped from the spec to avoid having the GLES implementers to waste time adding a legacy drawing API that is essentially useless and has awful performance.

GLES1 was a stripped down API for early mobile 3d applications that used rather primitive hardware or software.

There are lots of flaws in the GL(ES) API, but removal of immediate wasn't one of them. If anything, they should have fixed/broken the API more and intentionally destroy backward compatibility.

The the committees designing the API's are understaffed and have too much work on their hands. They're trying to make the interests of hardware manufacturers, content creators and OEM's match. Because of all these pressures, they're not really doing a great API but at least we have some kind of well-specified standard. Calling these people idiots doesn't help anyone.

With modern 3d API's, the vertex data is pushed into buffers in video memory. If you're writing 3d code in the 21st century, that's what you should do.

So a legacy feature that the author depended on was removed and rather than updating his code to run on modern software and hardware he re-implements it in software. He spends 3 days doing it, gets pissed off and writes a blog post.

-----

kmm 666 days ago | link

>If there are old features that you would like to discourage the use of, then you mark them as obsolete -- but you do not remove them because thou shalt not break working code. > If you don't agree with that, then please, get out of the software industry right now. Find another line of work. Please.

Arrogant and wrong. There was no working code in the first place, OpenGL ES is not OpenGL.

I, for one, am very glad with the changes the OpenGL board made. The glBegin/glEnd combo is so inane it should have been removed ages ago. Maintaining all these outdated codepaths carries its cost and clutters up documentation.

-----

AshleysBrain 666 days ago | link

My understanding is OpenGL ES is intentionally designed to be a subset of OpenGL so mobile devices can be simpler and therefore cheaper. It shouldn't be surprising mobile hardware and software is more limited. If deleting 80% of the platform features made your iPhone $50 cheaper and last another hour on battery, surely that's worth it?

Also, I believe the reason glVertex was removed is because it is a very inefficient way to draw. It wastes a lot of CPU time in "jump in to glVertex function, do a tiny amount of work, jump out of function, jump in to glVertex function, do a tiny amount of work...". It's to the extent that glDrawArrays is always faster. Take a buffer, fill it with data as fast as memory can transfer it, then a single function call to send all the data in one go, resulting in negligable overhead. Interesting anecdote: at least in my work in 2D games, modern GPUs are so fast they can render a quad faster than you can write its vertices to a vertex buffer on the CPU. So performance is limited by the CPU overhead! So this really makes a huge difference to the performance of some applications. And on mobile performance is usually more of an issue. So by removing the old functions, you're forced to do it in a more efficient way which may boost your framerate. Not so bad, huh? Unless, of course, you write a compatibility layer on top, which will reverse the performance gains.

Another reason there isn't a compatibility layer is it isn't OpenGL's job: it's supposed to be a super thin layer on the hardware so you can interface to the capabilities of the hardware as efficiently as possible. I also expect writing a compatibility layer that is standards-compliant in the general case is extremely difficult - check out all the effort that went in to ANGLE, for example.

So I think it's just a misunderstanding of the purpose and design of the tools. In future, I guess porting from OpenGL ES to desktop OpenGL would be a lot easier. 0.02

-----

mwd_ 666 days ago | link

Part of the story here is that OpenGL ES isn't a new version of OpenGL, it's a different API for different platforms. It's nice if you can take old code and make it run on a mobile device easily but overall that's probably a small consideration compared to having an clean API that performs well.

If we want to focus on immediate mode specifically, it arguably shouldn't be used even in regular old OpenGL. It's slower and results in overly verbose code. Most people seem to use immediate mode because that's what most of the tutorial examples use.

Maybe one way to tackle the switch from immediate mode -> vertex arrays (and maybe quads -> triangles) is just to make some macros that take old code blocks and generate new ones.

-----

AshleysBrain 666 days ago | link

Are you sure it's fair to call it a different API? OpenGL ES is officially described as "well-defined subsets of desktop OpenGL" [1], which would suggest it has a great deal in common with desktop OpenGL.

[1] http://www.khronos.org/opengles/

-----

nikic 666 days ago | link

I don't know much about OpenGL ES in particular, but backwards compatibility arguments are very tricky in general.

On the one hand you have all the people maintaining legacy apps and not interested in improving their code. They'll scream at you for breaking BC. On the other hand you have other people complaining that the library sucks due to all the old stuff and why they don't just remove all the crap.

I noticed this in particularly in the context of PHP. People really hate some parts of the language (for good!) and commonly demand a big BC breaking release that fixes all the bad parts. But every time something is fixed (obviously breaking BC in some way) there is a big outcry about wtf the developers have been thinking and whether they are all braindead - well, the usual stuff.

So really, before you start calling people idiots because they didn't keep comparability with an older version (or here even a completely different version), think again. There probably was a lot thought put into the decision. It's not like people just say "Oh, let's drop this, just so everyone can change his code!"

-----

opminion 666 days ago | link

This rant should probably say "my iPhone could run a full OpenGL implementation, and instead I'm provided a subset. I proved that it could run full OpenGL by writing most of the missing parts".

"(OpenGL ES) is a subset of the OpenGL" according to http://en.wikipedia.org/wiki/OpenGL_ES

-----

Ralith 666 days ago | link

Was there ever any question over whether an iPhone could run a full OpenGL implementation?

Perhaps the people JWZ should be complaining about are those who decided to provide OpenGL ES instead of OpenGL proper on the iPhone in the first place.

-----

qdog 666 days ago | link

People that don't study history are doomed to repeat it, or something like that. There's pretty much no reason to drop the old API calls, if you don't want it clogging stuff up, fine, make a separate library you have to throw a flag for or something.

Favorite quote: "If there are old features that you would like to discourage the use of, then you mark them as obsolete -- but you do not remove them because thou shalt not break working code.

If you don't agree with that, then please, get out of the software industry right now. Find another line of work. Please. "

-----

Ralith 666 days ago | link

This indicates a fundemental misunderstanding of OpenGL ES. It cannot break working code by not having OpenGL 1.0 features, because OpenGL ES is not a revision to or successor of OpenGL 1.0.

Note that OpenGL 4, which is a (distant) successor to OpenGL 1, does include OpenGL 1s features, marked as deprecated.

-----

zokier 666 days ago | link

OpenGL > 3.1 does not require implementation of compatibility profile, which includes deprecated funtionality. OSX doesn't.

-----

Ralith 665 days ago | link

Awesome! I wasn't aware that had become optional.

-----

Ralith 666 days ago | link

The thing that particularly bothers me about this post:

> People defend this decision by saying that they "had" to do it, because the fixed function pipeline is terribly inefficient on modern GPUs or some such nonsense. These people don't know what they're talking about, because the contour of the API has absolutely fuck-all to do with what goes over the wire.

As far as I can tell from what he's written, all he's done is forcibly enact the same inefficiencies that the paradigm shift away from immediate-mode rendering was intended to eliminate. The contour of the API in this case has a great deal to do with what goes over the wire: most critically, correctly-designed OpenGL ES programs will not retransmit static geometry to the GPU every single frame.

-----

koide 666 days ago | link

And what I've understood he's done is not to retransmit static geometry every single frame, but to use an array to send batches behind the scenes.

This is, the exposed API doesn't force any particular implementation.

And that makes a lot of sense.

-----

Ralith 665 days ago | link

If he's reimplemented the OpenGL 1 API, then he must be retransmitting geometry every frame, because the API is not sufficiently expressive to allow for retained state of that nature. He describes glBegin and glEnd as accumulating an array to batch out, but that batch gets re-accumulated and transmitted every single time the glBegin/End block is executed, i.e. every single frame.

-----

koide 665 days ago | link

Question from ignorance: Couldn't you internally buffer the geometries and, say, send them to the GPU every 5 frames or so?

-----

More



Lists | RSS | Bookmarklet | Guidelines | FAQ | DMCA | News News | Feature Requests | Bugs | Y Combinator | Apply | Library

Search: