I develop an OpengGLES application for Windows Mobile.
I have some problem with refresh of opengles, because I draw 2D elements above opengles layer.
I would like to know if it’s possible to define eglCreateWindowSurface only on a part of the screen ?
If not, is it possible to do glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) ; only on a part of the screen.

Thank you for your help.

I don’t think there’s any way of making a windowed surface for a sub-section of a window in Windows Mobile. Perhaps you can make a child-window, and make your egl-surface from that? I guess that only works if you have a rectangular sub-section of the window you want to render to.

glClear() can affect only a part of the framebuffer, by using scissoring. However, glClear modifies the back-buffer, and not the front-buffer, and when eglSwapBuffers() is called, it will still overwrite your 2D elements.

Now, mixed rendering is really hairy, and I’d strongly recommend you stick to one API for all your rendering. Can you for instance render your 2D elements to a bitmap, and upload that as a texture? Or possibly better, can you render it directly with OpenGL ES?

I want to have an instructions page in my OpenGL ES game. You say that mixed rendering is messy, so do you mean that it is better to write all the instructions on a texture, which I then put on a rectangle which is shown directly in front of the camera? This approach would avoid any mixed rendering.

Just to throw out an idea, if your platform support layer/overlays, you might be able to access them via the level attribute of an egl config. That way you could easily overlayer your UI on top without affecting the contents of your other window. Alternatively, if your native graphics support layer/overlays you could just use the native API to do everything including rendering.

If your stuck with a single layer, then egl on it’s own doesn’t have any mechanism for doing composition, or even set the position of an eglWindowSurface. So you would need to see if your particular platform provides some kind of a windowing system (or something like OpenWF) which would grant you more flexibility.