What is a platform anyway?

After the previous blog, I figured I wanted to add something on people’s interpretations of OSes, platforms and API’s.

Starting with OpenGL, I have already blogged about the PS3 in the past, where people think it uses OpenGL. At best it uses OpenGL ES 1.0 and some extensions, including nVidia’s Cg, which theoretically is also available on other platforms. Problem there is, it is nVidia Cg. It relies heavily on nVidia’s custom OpenGL extensions. So while OpenGL + Cg is portable between different OSes, it is not that portable between different vendors. There is a fallback in Cg where you can compile the shaders for standard OpenGL 2.0 ARB vertex and fragment programs. However, that limits you to very basic SM2.0 functionality (we are talking 2002 here). So although OpenGL (ES) is cross-platform and nVidia Cg is cross-platform, using the two does not guarantee that the code will run everywhere. And of course OpenGL ES is not quite the same as regular OpenGL either. The two are quite similar, and it is not too hard to abstract the differences away, but you can’t just compile OpenGL code on an OpenGL ES platform and vice-versa.

Then I’d like to say a few things about linux. On the one hand, it seems that quite a few people don’t quite understand the relationship between UNIX and linux. I’ve already blogged about that in the past as well, about how people think OS X is based on linux, just because it is a UNIX-derivative. Although clearly linux is a UNIX-clone, obviously not all UNIX-like OSes are linux. There are other UNIX-clones, and then there are real UNIX OSes as well. So just because the untrained eye can’t tell the difference between linux, BSD, or various other UNIX-like OSes, that doesn’t mean they’re all linux.

Secondly, even OSes that ARE built on linux (as in: the kernel), aren’t linux in the sense of a GNU/linux distribution. One example I could give is the GP2X that I used for a demo a few months ago. Yes, its OS uses the linux kernel, and it is somewhat of a stripped-down linux distribution. So it is possible to compile and run a lot of linux software on it. However, the demo we did is not just linux software. In the oldskool tradition that we know from C64 and Amiga, we access the GP2X custom hardware directly. Our demo will not run on anything other than a GP2X. At least, not as-is. There is a Windows port, which uses a software emulation library for the custom hardware. Most linux software, including games/demos, will not access hardware directly, but go through an API/hardware abstraction layer such as SDL or OpenGL, which makes it less dependent on the actual hardware.

Which brings me to Android. This is another platform that is based on the linux kernel. But again, it’s not a regular GNU/linux distribution. There is the Dalvik VM on top of the stripped-down linux environment. And Dalvik is not available on regular linux distributions. So Android applications won’t run on regular linux. And since the linux portion of Android is rather stripped down, you can get some linux software to run on it, but not everything. In many cases you need to interface between the Dalvik layer and the linux layer. An Android app normally starts as a Dalvik app, and can call native C/C++ code via JNI, from which you can access the linux layer. However, some functionality is only exposed through the Dalvik layer, so you sometimes need to call back into Dalvik from C/C++. Again I already mentioned that in an earlier blog.

So, these things are all quite vaguely defined. Depending on the context, the definition of OS, platform or API can be wider or smaller, and may or may not include hardware-specific details. Sadly a lot of people build arguments based on the wrong definition for the context in which they speak. One of the nicest examples of that was in an OpenGL vs DirectX blog some time ago, which again I covered in an earlier blog. This is what I mean:

“On the other hand, if you use OpenGL, you get faster and more powerful graphics features than DirectX 11, and you get them on all versions of Windows, Mac and Linux, as well as the PS3, Wii, PSP, DS, and iPhone.”

As I already pointed out in that blog: you can’t use the graphics features of DirectX 11 if your hardware doesn’t support them. PS3, Wii, DS and iPhone don’t have DirectX 11-capable hardware by definition. For Windows, Mac and linux it depends on the videocard you’re using. So they apply a definition of OpenGL which does not include the hardware capabilities, then project that onto a wide range of hardware, where the hardware capabilities DO matter. This is how people ‘promote’ OpenGL and linux. Lovely.

This entry was posted in Direct3D, Hardware news, OpenGL, Software development, Software news and tagged , , , , , , , , , , . Bookmark the permalink.

1 Response to What is a platform anyway?

  1. mhagain says:

    What was particularly striking about That Blog was that the person who wrote it SHOULD have known better. A charitable part of me might suspect a case of “sufficiently advanced parody being indistinguishable from the real thing” – only this kind of thing is so prevalent that I don’t feel too inclined to charity right now.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s