简体   繁体   English

OpenGl ES glPushAttrib()3D模型渲染

[英]OpenGl ES glPushAttrib() 3D model rendering

I know that I can't do glPush/PopAttrib in openGL ES and that I have to do this manually. 我知道我不能在openGL ES中执行glPush / PopAttrib,而且我必须手动执行此操作。 My question is: What do I need to enable/disable and psuh/pop in order to properly render 3D models? 我的问题是:为了正确渲染3D模型,我需要启用/禁用和psuh / pop?

The problem I have is that colors are being mixed between different object to render. 我遇到的问题是颜色在不同的对象之间混合呈现。 Also, some object do not have textures and it looks like it is trying to apply one to it. 此外,某些对象没有纹理,看起来它正在尝试应用一个纹理。

Is there a "safe" maybe not optimised way to make sure every time I render a new object the openGL state is "clean" ? 有没有“安全”可能没有优化的方法来确保每次渲染一个新对象时,openGL状态是“干净的”? Kinda like glPushAttrib(GL_ALL_ATTRIB_BITS) 有点像glPushAttrib(GL_ALL_ATTRIB_BITS)

No, there isn't. 不,没有。 But there are much fewer possible states (~10) in OpenGL ES 2.0, everything else is controlled by your very own shaders, anyway. 但是OpenGL ES 2.0中可能的状态(~10)要少得多,其他一切都是由你自己的着色器控制的。 Basically you just have to enable/disable all possible states to be sure (and properly configure the ones you enabled). 基本上你只需要启用/禁用所有可能的状态(并正确配置你启用的状态)。

A list of all states can be found here: 可以在此处找到所有州的列表:

http://www.khronos.org/opengles/sdk/docs/man/xhtml/glEnable.xml http://www.khronos.org/opengles/sdk/docs/man/xhtml/glEnable.xml

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM