Results 1 to 5 of 5

Thread: how big can you set glViewport()?

  1. #1
    Member Newbie
    Join Date
    Jun 2009
    Posts
    47

    how big can you set glViewport()?

    hi there i was thinking of doing fullscreen anti-aliasing where you'd overscale the glViewport a couple of times bigger than the actuall window size, when testing this im not quite sure what is happening. it seems that im diffrent quadrants of the oversized viewport are viewed at once or something like that.

    anyone know if this is a good idea? performance wize or if its even feasable? considering that i've never seen a fullscreen anti-aliasing done this way im guessing a NO on both of them.

  2. #2
    Member Contributor
    Join Date
    Jul 2009
    Posts
    53

    Re: how big can you set glViewport()?

    Use glGet with GL_MAX_VIEWPORT_DIMS.

  3. #3
    Senior Member OpenGL Lord
    Join Date
    Mar 2015
    Posts
    6,674

    Re: how big can you set glViewport()?

    anyone know if this is a good idea?
    It won't work. Pixels outside of the window will automatically fail the pixel ownership test, so the OpenGL implementation is perfectly free to not write them.

    If you want to do this, you have to use an FBO.

  4. #4
    Senior Member OpenGL Guru
    Join Date
    Oct 2004
    Posts
    4,651

    Re: how big can you set glViewport()?

    Quote Originally Posted by ColacX
    hi there i was thinking of doing fullscreen anti-aliasing where you'd overscale the glViewport a couple of times bigger than the actuall window size, when testing this im not quite sure what is happening. it seems that im diffrent quadrants of the oversized viewport are viewed at once or something like that.

    anyone know if this is a good idea? performance wize or if its even feasable?
    As always, it depends. I presume you're talking about rendering your picture NxN times bigger (e.g. 2X2) in resolution, and then scaling down the result by NxN. This is generally called "supersampling" (aka SSAA). That is, for each final pixel, you're "shading" multiple times per pixel.

    Supersampling is expensive, particularly when your shading cost per pixel is already high (multiply that by 2x2=4, 3x3=9, etc.).

    Often times you don't really need better "shading" accuracy (i.e. interior of polygons). You just need better "edge" accuracy (edges of polygons), to avoid the jaggies you'd otherwise see at the edges. In these cases, it's sometimes much cheaper to use what's termed "multisampling" (aka MSAA). With MSAA, you only shade once per final pixel, but you end up computing pixel coverage multiple times per pixel. This is a big benefit if your shading cost per pixel is already pretty high (e.g. complicated fragment shaders).

    NVidia's Coverage Sample AA (aka CSAA) is a memory/perf optimization of MSAA.

    So bottom line: if you've got enough perf for what you're doing now, just go with it. If you need more perf, then try MSAA or CSAA. If you need help determining how to try MSAA (no code changes required), then just follow-up!

    considering that i've never seen a fullscreen anti-aliasing done this way im guessing a NO on both of them.
    Oh no, it's sometimes done, especially in cases where the video hardware is too crippled to render a full frame of video output at once. An example is the XBox 360, where there's just not enough RAM to do render an entire frame at once using the required 2X AA. So you have to fill with multiple passes.

  5. #5
    Member Newbie
    Join Date
    Jun 2009
    Posts
    47

    Re: how big can you set glViewport()?

    Quote Originally Posted by Alfonse Reinheart
    It won't work. Pixels outside of the window will automatically fail the pixel ownership test, so the OpenGL implementation is perfectly free to not write them.

    If you want to do this, you have to use an FBO.
    Okay this probly explains my weird result.

Similar Threads

  1. using glViewport
    By richman.feynard in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 08-31-2017, 04:07 AM
  2. glViewport
    By A elalaily in forum OpenGL: Basic Coding
    Replies: 9
    Last Post: 12-26-2009, 02:57 PM
  3. glViewport
    By V-man in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 03-08-2005, 05:54 PM
  4. glViewport
    By gurkama in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 02-14-2005, 10:46 PM
  5. glViewport()
    By huizhang in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 09-24-2002, 12:12 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