Tony Teng
Tony Teng

Reputation: 125

How do I implement glPushAttrib(GL_CURRENT_BIT) in OpenGL ES 1.x

I'm trying to modify my OpenGL project to OpenGL ES 1.x. But there is a function call I can't find any solution for me to replace it.

glPushAttrib(GL_CURRENT_BIT | GL_LIGHTING_BIT | GL_COLOR_BUFFER_BIT | GL_ENABLE_BIT );

I can't find GL_CURRENT_BIT mask and glPushAttrib function in OpenGL ES 1.x.

Simply, I just remove the GL_CURRENT_BIT mask from the glPushAttrib parameters, and the application show the wrong background on the window(I tested it on the OpenGL environment. and the background is a texutre.). Is there any solution for me to replace glPushAttrib(GL_CURRENT_BIT) and let me run the application correctly on the OpenGL or Is there any solution for me to implement glPushAttrib(GL_CURRENT_BIT) which I can run both on OpenGL and OpenGL ES correctly? Thanks!

Upvotes: 4

Views: 956

Answers (1)

MuertoExcobito
MuertoExcobito

Reputation: 10049

glPushAttrib does not exist in OpenGL ES. The function that is intended to take the GL_CLIENT_PIXEL_STORE_BIT as an input is actually glPushClientAttrib, which also doesn't exist (and thus, neither does the constant).

The functionality of these is essentially to store all states that can be set with the glPixelStorei function. This can be implemented manually, by recording these states as they are set, and making the equivalent calls to glPixelStorei to restore them. See here (item #8) for a discussion (which about OpenGL, by applies to OpenGL ES, in that, it doesn't have glPush/PopClientAttrib).

Upvotes: 3

Related Questions