Problem refreshing resize

Hello everyone, I’m having a problem when I resize a window.
After I make a resize I do this:

glViewport(0, 0, width, height);
glReadBuffer(GL_FRONT);
glDrawBuffer(GL_BACK);

Now I want to do the same with OpenglES but I don’t have glReadBuffer and glDrawBuffer, so I tried remove them but it didn’t work because the opengl scene didn’t refresh the resize.
Someone know how to replace the glReadBuffer and glDrawBuffer functions? Because I didn’t found a solution.
Thanks a lot
Santiago

Assuming you have an egl implementation on your platform, I’d suggest the eglMakeCurrent, eglSwapBuffers functions depending on what exactly your application is doing. If you don’t have egl, then you’ll need to use whatever native graphics framework to manage your color buffers.

Also keep in mind, GLES does not include any window resizing callbacks like those available in GLUT for desktop GL. So if your mingling GLUT functions calls with GLES function calls be mindful of the fact things may not work as expected, if at all.

I’m using Vincent implementation (http://www.vincent3d.com/).
My desktop code is something like this:


wglMakeCurrent(deviceContextHandle,renderingContextHandle);

glViewport(0, 0, width, height);
glReadBuffer(GL_FRONT);
glDrawBuffer(GL_BACK);

and on OpenGLES I tried something like this:


glesDisplay := eglGetDisplay(deviceContextHandle);
glesSurfaceRead = eglGetCurrentSurface(EGL_READ);
glesSurfaceDraw = eglGetCurrentSurface(EGL_DRAW);
eglMakeCurrent(glesDisplay, glesSurfaceDraw, glesSurfaceRead, eglGetCurrentContext);

glViewport(0, 0, width, height);
eglSwapBuffers(glesDisplay, glesSurfaceRead);

But it didn’t work, I don’t know if someone could help me.
Thanks in advance
Santiago

Maybe you could explain what you’d expect to happen when you execute the last line in your example? And how this relates to resizing?

  • HM

I upload a screenchot to make it clear.

When I resize the window I expect to happen what you can see on the right, but I obtain the result that you can see on the left.
The lines are bigger than the original size but the scene has the same size than the original.
If you asked me about the swapBuffers… I don’t know why I do a swapBuffer, I’m a newbie and I tried different things to see if I can correct my problem.
Thanks

It looks like your viewport is not updated with the correct window dimensions after your window is resized. How are you detecting when a resize of your window occurs? The win32 api generates a WM_SIZE event when a window resize occurs which can use to update the viewport with the correct dimensions.

You will need to create new rendering surface matching the new window size and re-associate them with the context. As the previous reply indicated, this needs to happen as response to WM_SIZE.

You can see this in http://ogl-es.svn.sourceforge.net/viewvc/ogl-es/trunk/ogles/ug/ug_win32.c?revision=337&view=markup as response to WM_SIZE.

Hope that helps.

  • HM

Thanks a lot for the information! I’m going to try what you told me.
Santiago

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.