1mjb – December 22, 2006Cool New Features in GLSLMike BaileyOregon State Universitymjb – December 22, 2006The Geometry Shader:Fixed FunctionVertex ProcessingVertex ShaderTransformed positionPrimitive Assembly Geometry ShaderPrimitive AssemblyColor ClampingFlat ShadingClippingHomogeneous DivideViewport TransformFacing DeterminationRasterizationFragment ShaderFixed FunctionFragment ProcessingNote: a shader program can have any combination of vertex, geometry, and fragment shaders in it. All three are not required concurrently.2mjb – December 22, 2006New GLSL Operations• Integer bitwise operations: << >> % & | ^ ~• T truncate( T x ); -- integer closest to x whose abs is not larger than abs(x)• T round( T x ); -- integer closest to x• Integer versions of: abs, clamp, min, max, signmjb – December 22, 2006New Texture Routinesvec4 rgba = texture2DArray( sampler2DArray sa, vec3 stp ) ;ivec4 irgba = texture2D( isampler2D is, float st ) ;vec4 rgba = texelFetch2D( sampler2D s, ivec2 ist, int lod ) ;ivec2 sizexy = textureSize2D( sampler2D s, int lod ) ;Texture arrays:Textures that return integer values:Textures whose indices are integers (=“texture fetching”):Querying texture size (useful for texture fetching):3mjb – December 22, 2006New Keywords• #ifdef GL_EXT_gpu_shader4• noperspective -- causes interpolation to be in screen space, not perspectively correct• flat – causes no interpolation to take place• centroidNew application #ifdef:New shader variable
View Full Document