PowerVR SGX 540 glViewport

This topic contains 3 replies, has 2 voices, and was last updated by  Joe Davis 5 years, 9 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #30716


    I wrote application (Samsung Galaxy Nexus – Android 4.0, OpenGL ES 1.1) that renders scene into 2 viewports. Each glDrawElements/glDrawArrays is below scheme:

    renderLoop {

    1. glViewport (left part of screen),

    2. glDrawArrays/glDrawElements

    3. glViewport (right part of screen).

    4. glDrawArrays/glDrawElements


    I render to FBO with texture as color attachment. I found that switching viewport is very time consuming. Can anyone explain why ??

    The same application works 5-10 times faster on Qualcomm chipset (Adreno200). ??


    Joe Davis


    Can you explain what your use case is? Is this to display the render in 3D by getting the user’s eyes to each look at one side of the screen?

    Just to clarify – are you only calling glViewport twice per frame, or are you calling it repeatedly?
    It’s best on our GPUs to avoid unecessarily changing the viewport while rendering to a surface. Have you tried rendering the left side of the screen to one FBO, the right side to another and then blitting the two textures to the framebuffer? This approach would avoid changing the viewport during the render loop and may give you better performance.


    Joe2012-01-10 15:17:03


    Yes, You are correct, this is 3D use case.

    I repeat every call to glDrawArrays/glDrawElements for left and right eye. So glViewport is called twice on each call to glDrawArrays/glDrawElements.

    Using 2 FBOs is not acceptable due to switching time between FBOs. It kills performance much more than switching viewport.


    Joe Davis

    Ah, ok. If you change your render to do the following it should be much more efficient, as it will remove redundant glViewport() calls:

    1. Set the viewport for the left eye
    2. Render all objects for the left eye
    3. Set the viewport for the right eye
    4. Render all objects for the right eye

    This approach will only require the viewport to be set twice per frame (once for the left side of the screen, once for the right).

    Switching between FBOs shouldn’t have a high cost on our hardware.

Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic.