Results 1 to 5 of 5

Thread: is glViewport needed or used in OpenGL ES 2.0?

  1. #1
    Member Contributor
    Join Date
    May 2010
    Posts
    66

    is glViewport needed or used in OpenGL ES 2.0?

    What does glViewport do when you are using OpenGLES 2.0? Isn't everything defined by the various matrices you use in the shaders?

    Bob

  2. #2
    Member Newbie
    Join Date
    Nov 2012
    Posts
    33
    Hi Bob,

    Don't confuse glViewport with the transformation matrices (as I did not too long ago). All glViewport does is define the area of the drawing context that you will actually draw to.

    For example, let's assume your window is 800 by 600 pixels. Calling glViewport(0, 0, 800, 600) means you will draw to the whole screen. Calling glViewPort(0, 0, 400, 300) means you will only draw in the bottom left quadrant.

  3. #3
    Member Contributor
    Join Date
    May 2010
    Posts
    66
    I still thought that somehow what the viewport call did ultimately boiled down to what the projection matrices did.

    So it is needed in OpenGLES 2?

  4. #4
    Member Newbie
    Join Date
    Nov 2012
    Posts
    33
    I can't give you a 100% sure answer since I don't personally work with OpenGL ES 2.0, but you should still need it, if only just once during your initialization.

    Generally glViewport would help if you were trying to draw multiple views, like in 3D modeling software or multiplayer split-screen games. Half the window might use one set of projection matrices, like perspective; the other half may use another, like orthographic. A call to glViewport scales (and depending on your transformation matrices, possibly distorts) the drawing output/buffer to fit within the rectangle you set. If you use a fully symmetrical projection matrix, the vanishing point will be at the center of your specified viewport.

  5. #5
    Senior Member Frequent Contributor
    Join Date
    Dec 2007
    Location
    Hungary
    Posts
    992
    Yes, it is needed. glViewport sets the viewport that is used by the viewport transformation step which transforms NDCs (normalized device coordinates) to viewport coordinates. This is needed both in OpenGL ES 2.0+ and OpenGL Core 3.x+
    Disclaimer: This is my personal profile. Whatever I write here is my personal opinion and none of my statements or speculations are anyhow related to my employer and as such should not be treated as accurate or valid and in no case should those be considered to represent the opinions of my employer.
    Technical Blog: http://www.rastergrid.com/blog/

Similar Threads

  1. opengl es help needed.
    By smultring in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 04-07-2010, 05:13 PM
  2. Help needed in using opengl !
    By gajoshi2000 in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 06-02-2007, 01:33 AM
  3. OpenGL help needed
    By mysterio86 in forum OpenGL: Linux
    Replies: 1
    Last Post: 07-11-2005, 02:02 AM
  4. OpenGL needed
    By VGD in forum OpenGL: User Software
    Replies: 1
    Last Post: 07-25-2002, 11:50 AM
  5. opengl.dll needed
    By FuzzyLogic in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 09-08-2001, 02:01 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean