Is it a big deal switching from OpenGL 3.0 to OpenGL ES 2.0?
Asked Answered
J

2

1

If I am currently developing a game for windows using SDL and GLEW (for OpenGL 3.0+) and I later want to port my game to Android, will I have to rewrite the majority of my code to convert from OpenGL 3.0 to OpenGL ES 2.0? Are there any programs that do this for me? Is it a big deal switching from OpenGL to OpenGL ES?

Journeywork answered 16/7, 2015 at 1:51 Comment(2)
This is something you could have figured out yourself with a quick google search.Cordalia
possible duplicate of OpenGL ES 2.0 vs OpenGL 3 - Similarities and DifferencesCordalia
M
1

It really depends on your code

OpenGL ES 2.0 (and 3.0) is mostly a subset of Desktop OpenGL.

The biggest difference is there is no legacy fixed function pipeline in ES. What's the fixed function pipeline? Anything having to do with glVertex, glColor, glNormal, glLight, glPushMatrix, glPopMatrix, glMatrixMode, etc... in GLSL using any of the variables that access the fixed function data like gl_Vertex, gl_Normal, gl_Color, gl_MultiTexCoord, gl_FogCoord etc...

If you use any of those features you'll have some work cut out for you. OpenGL ES 2.0 and 3.0 are just plain shaders. No "3d" is provided for you. You're required to write all projection, lighting, texture references, etc yourself.

If you're already doing that (which most modern games probably do ) you might not have too much work. If on the other hand you've been using those old deprecated OpenGL features which from my experience is still very very common (most tutorials still use that stuff). Then you've got a bit of work cut out for you as you try to reproduce those features on your own.

There is an open source library, regal, which I think was started by NVidia. It's supposed to reproduce that stuff. Be aware that whole fixed function system was fairly inefficient which is one of the reasons it was deprecated but it might be a way to get things working quickly.

Malcolm answered 4/3, 2016 at 17:57 Comment(0)
C
3

Not at all, it is very easy to convert.

Only differences are shader variables and constants, and suffixes like GL_RGBA8 to GL_RGBA8_OES. However, there are limits in OpenGL ES. For instance, you can use only GL_UNSIGNED_BYTE or GL_UNSIGNED_SHORT as indices data type GL_UNSIGNED_INT. Which means, you can not draw more than 65,535 indices at one go. It is not a big deal although you should refer to the official OpenGL ES manual, https://www.khronos.org/opengles/sdk/docs/man/

Refer to the link OpenGL ES 2.0 vs OpenGL 3 - Similarities and Differences by coffeeandcode

Cask answered 16/7, 2015 at 1:51 Comment(6)
I wouldn't say this is generally true. OpenGL 3.x has substantial features that are not available in ES 2.0. If you use any of them, porting to ES 2.0 will take significant work, or will be flat out impossible for some features.Plummy
I am using my own rendering engine which is combined GL 3.3 and GL ES 2.0. It works on all platforms but that's true too because relatively, GL ES has no enough features by reason of weak mobile performance. I am wondering if you can tell me which features are impossible to convert.Cask
VAOs (ok, they're exposed by an ubiquitous extension, but not in ES2)? Transform feedback? Geometry Shaders? Shader language incompatibility (no default precision for floats in the fragment language; in and out vs attribute and varying; texture vs texture2D)? The list is long...Francklyn
VAO is in es 2.0 (glBindVertexArrayOES), Geometry Shader is not in 3.3 and es 3.0 has Geo Shader as well. I mentioned the shader code, and it is not a big deal I think.Cask
But if I am serious about Android game dev, what should I use in general?Journeywork
It depends what you want although In general, Android developers can use FBO VBO RTT and so on as usual except things above but not VAO because VAO is note officially supported. Just do it and get back to me when you face any problem.Cask
M
1

It really depends on your code

OpenGL ES 2.0 (and 3.0) is mostly a subset of Desktop OpenGL.

The biggest difference is there is no legacy fixed function pipeline in ES. What's the fixed function pipeline? Anything having to do with glVertex, glColor, glNormal, glLight, glPushMatrix, glPopMatrix, glMatrixMode, etc... in GLSL using any of the variables that access the fixed function data like gl_Vertex, gl_Normal, gl_Color, gl_MultiTexCoord, gl_FogCoord etc...

If you use any of those features you'll have some work cut out for you. OpenGL ES 2.0 and 3.0 are just plain shaders. No "3d" is provided for you. You're required to write all projection, lighting, texture references, etc yourself.

If you're already doing that (which most modern games probably do ) you might not have too much work. If on the other hand you've been using those old deprecated OpenGL features which from my experience is still very very common (most tutorials still use that stuff). Then you've got a bit of work cut out for you as you try to reproduce those features on your own.

There is an open source library, regal, which I think was started by NVidia. It's supposed to reproduce that stuff. Be aware that whole fixed function system was fairly inefficient which is one of the reasons it was deprecated but it might be a way to get things working quickly.

Malcolm answered 4/3, 2016 at 17:57 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.