从OpenGL 3.0切换到OpenGL ES 2.0是否有重大意义? [英] Is it a big deal switching from OpenGL 3.0 to OpenGL ES 2.0?

查看:229
本文介绍了从OpenGL 3.0切换到OpenGL ES 2.0是否有重大意义?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我当前正在使用SDL和GLEW(适用于OpenGL 3.0+)开发适用于Windows的游戏,而后来又想将游戏移植到Android,我是否必须重写大部分代码以将OpenGL 3.0转换为OpenGL ES 2.0?有什么程序可以帮我吗?从OpenGL切换到OpenGL ES是否有很大的意义?

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?

推荐答案

这真的取决于您的代码

OpenGL ES 2.0(和3.0)主要是Desktop OpenGL的子集.

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

最大的区别是,ES中没有遗留的固定功能管道.什么是固定功能管道?使用访问固定功能数据的任何变量,与GLSL中的glVertexglColorglNormalglLightglPushMatrixglPopMatrixglMatrixMode等相关的任何事情例如gl_Vertexgl_Normalgl_Colorgl_MultiTexCoordgl_FogCoord等...

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...

如果您使用这些功能中的任何一个,将为您完成一些工作. OpenGL ES 2.0和3.0只是普通着色器.没有为您提供"3d".您需要自己编写所有投影,照明,纹理参考等.

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.

如果您已经这样做了(大多数现代游戏可能会这样做),那么您可能没有太多的工作.另一方面,如果您一直在使用那些不推荐使用的旧OpenGL功能,但根据我的经验,这些功能仍然非常普遍(大多数教程仍在使用该功能).然后,当您尝试自己重现这些功能时,您需要做一些工作.

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.

有一个开源库 regal ,我认为它是由NVidia启动的.应该复制这些东西.请注意,整个固定功能系统效率很低,这是不赞成使用的原因之一,但它可能是使事情快速运行的一种方式.

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.

这篇关于从OpenGL 3.0切换到OpenGL ES 2.0是否有重大意义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆