3

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!

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
Tony Teng
  • 105
  • 8

1 Answers1

2

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

MuertoExcobito
  • 9,741
  • 2
  • 37
  • 78
  • thanks for your answering. I'm sorry, I write a wrong constant. Which I'm really want to ask is GL_CURRENT_BIT. Is there any solution for me to replace glPushAttrib(GL_CURRENT_BIT)? – Tony Teng Feb 16 '17 at 06:30
  • The same solution applies to your modified question, except with different states. If you go to the link for `glPushAttrib`, there is a table indicating what states it saves. In GLES, you will just have to record these settings (in your code) and set them again to get the same functionality. – MuertoExcobito Feb 16 '17 at 13:56
  • Thanks, I have solved this problem. I find an open source project named glues. It implements the glPushAttrib function. thanks again. – Tony Teng Feb 17 '17 at 03:27