OpenGL ES claims to be a subset of OpenGL, which theoretically means any OpenGL ES program can run as regular OpenGL on a PC; however, it seems OpenGL ES has slightly different naming conventions for some functions (glOrtho
vs glOrthof
). Does this matter? Can an OpenGL ES app still work with an OpenGL GPU/driver out of the box or with only a recompilation?
The main difference between the two is that OpenGL ES is made for embedded systems like smartphones, while OpenGL is the one on desktops. On the coding level, OpenGL ES does not support fixed-function functions like glBegin/glEnd etc... OpenGL can support fixed-function pipeline (using a compatibility profile).
Context types. Until version 3.0, all versions of OpenGL were fully backwards compatible with earlier ones. Code written against OpenGL 1.1 could execute just fine on OpenGL 2.1 implementations. OpenGL version 3.0 introduced the idea of deprecating functionality.
OpenGL runs on desktops/laptops etc. OpenGLES runs on embedded systems (duh, ES stands for embedded systems). So.. if you have a very good GPU on your embedded system (like a phone) and a very old GPU on your desktop, then OpenGL ES would run faster, as it would be running on a faster GPU.
June 2022) OpenGL for Embedded Systems (OpenGL ES or GLES) is a subset of the OpenGL computer graphics rendering application programming interface (API) for rendering 2D and 3D computer graphics such as those used by video games, typically hardware-accelerated using a graphics processing unit (GPU).
Can an OpenGL ES app still work with an OpenGL GPU/driver out of the box or with only a recompilation?
No. Kinda, but since you brought up glOrtho
, which means you're talking about ES 1.x rather than 2.x, not for you. ES 3.0 adds some new stuff to the mix; see the bottom for details.
OpenGL ES 1.x is not a subset of any version of OpenGL. They are some pretty significant differences. You might, might be able to code to a common subset, but you'd be throwing away a lot to do it. On both platforms.
ES 2.x shares far more similarities with desktop GL 2.1, but it still isn't a proper subset. For example glTexImage2D
has radically different behavior. Under desktop GL, the last three parameters do not affect the actual format for the texture. Under ES 2.0, they are what defines the texture's actual image format. You can write a valid glTexImage2D
command that will do the same thing under ES 2.0 and desktop GL 2.1, but you're throwing away a lot under desktop GL to do it (like picking a sized internal format).
That being said, you can generally cordon off the API differences with abstractions. The big problem you're going to run into with ES 2.0 is GLSL.
GLSL ES added several new keywords, specifically precision qualifiers. Desktop GLSL 1.20 (which pairs with GL 2.1) doesn't have those keywords. Desktop GLSL 1.30 and greater do, but those are bound to GL 3.0 hardware. So it's difficult to write a shader for ES 2.0 that will run unmodified on desktop GL 2.1 hardware.
This is not insurmountable of course. A few judicious #defines, which themselves can be #ifdef'd for the different languages, can make this fairly simple. But you still have to find all of these cases.
The recently released OpenGL ES 3.0 is not a proper subset of OpenGL 3.3 either, but it is rather closer than ES 2.0. The really important thing is that GLSL 3.30 is almost identical to GLSL ES 3.00. So you can much more easily interchange shaders between the two.
There are certain limits in ES 3.0 that aren't in 3.3, but generally these are easily avoidable (and using most of them is bad practice anyway). And some of the features of ES 3.0 aren't technically in GL 3.3, but they are in commonly-available core extensions to GL 3.3 (such as ARB_texture_storage, and there's the ES3_compatibility extension to increase compatibility). But it's a lot easier to work with now that glTexImage2D
actually works the same way between the two cases. Now, interop is more a matter of avoiding functionality not available to both.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With