Graphics Reference
In-Depth Information
This section will introduce two extensions:
GL_ARM_shader_framebuffer_fetch
GL_ARM_shader_framebuffer_fetch_depth_stencil
3.2.1 GL ARM shader framebuffer fetch
This extension enables reading of the existing framebuffer color. This enables
use-cases such as programmable blending and other operations that may not be
possible to implement using fixed-function blending.
The extension is enabled by adding
# extension GL ARM shader framebuffer fetch : enable
to the very start of a fragment shader.
See Table 3.1 for a list of the built-in variables added by the extension and
Listing 3.1 for a simple programmable blending example using the extension.
Variabl e
Type Description
Reads the existing framebuffer color.
gl_LastFragColorARM
vec4
Tab l e 3. 1. New built-in variables introduced with the GL_ARM_shader_frame
buffer_fetch extension.
#extension GL ARM shader framebuffer fetch : enable
precision mediump float ;
uniform vec4 uBlend0 ;
uniform vec4 uBlend1 ;
void main ( void )
{ vec4 Color = gl_LastFragColorARM ;
Color = lerp ( Color , uBlend0 , Color . w
uBlend0 . w );
Color ￿ = uBlend1 ;
gl FragColor = Color ;
}
Listing 3.1. Programmable blending using GL_ARM_shader_framebuffer_fetch .
Search WWH ::




Custom Search