set_samples_per_pixel


Description:

public void set_samples_per_pixel (int samples_per_pixel)

Requires that when rendering to this then n point samples should be made per pixel which will all contribute to the final resolved color for that pixel.

The idea is that the hardware aims to get quality similar to what you would get if you rendered everything twice as big (for 4 samples per pixel) and then scaled that image back down with filtering. It can effectively remove the jagged edges of polygons and should be more efficient than if you were to manually render at a higher resolution and downscale because the hardware is often able to take some shortcuts. For example the GPU may only calculate a single texture sample for all points of a single pixel, and for tile based architectures all the extra sample data (such as depth and stencil samples) may be handled on-chip and so avoid increased demand on system memory bandwidth.

By default this value is usually set to 0 and that is referred to as "single-sample" rendering. A value of 1 or greater is referred to as "multisample" rendering.

<note>There are some semantic differences between single-sample rendering and multisampling with just 1 point sample such as it being redundant to use the resolve_samples and resolve_samples_region apis with single-sample rendering.< /note>

<note>It's recommended that resolve_samples_region be explicitly used at the end of rendering to a point sample buffer to minimize the number of samples that get resolved. By default Cogl will implicitly resolve all framebuffer samples but if only a small region of a framebuffer has changed this can lead to redundant work being done.</note>

Parameters:

this

A Framebuffer framebuffer

samples_per_pixel

The minimum number of samples per pixel