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.

Use glGet with GL_MAX_VIEWPORT_DIMS.

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.

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.

Okay this probly explains my weird result.