Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.

Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.

4.
Shading
• Shading
– Shading refers to depicting depth perception in 3D
models or illustrations by varying levels of darkness.
– In computer graphics, shading refers to the process of
altering the color of an object/surface/polygon in the
3D scene, based on its angle to lights and its distance
from lights to create a photorealistic effect. Shading is
performed during the rendering process by a program
called a shader.

21.
GLSL Versions
• Until version 3.30, the GLSL version number and the corresponding OpenGL version number
were different. Here's a table:
• Direct3D Shader Model 4.0 is equivalent to GLSL version 3.30. Earlier GLSL versions for
OpenGL 3.x provide subsets of this functionality, based on the available functionality in the
OpenGL version, though 1.50 is almost feature-identical to SM4
• Direct3D Shader Model 5.0 is equivalent to GLSL version 4.30.
• http://www.opengl.org/wiki/Detecting_the_Shader_Model
OpenGL Version GLSL Version
2.0 1.10
2.1 1.20
3.0 1.30
3.1 1.40
3.2 1.50

24.
OpenGL ES Versions
Version Description
OpenGL ES 1.0
Android
Standard
• Quad and polygon rendering primitives,
• Texgen, line and polygon stipple,
• Polygon mode and antialiased polygon rendering are not supported, although rendering using multisample is still possible (rather
than alpha border fragments),
• ARB_Image pixel class operation are not supported, nor are bitmaps or 3D textures,
• Several of the more technical drawing modes are eliminated, including frontbuffer and accumulation buffer. Bitmap operations,
specifically copying pixels (individually) is not allowed, nor are evaluators, nor (user) selection operations,
• Display lists and feedback are removed, as are push and pop operations for state attributes,
• Some material parameters were removed, including back-face parameters and user defined clip planes.
OpenGL ES 1.1
Android 1.6
• Better multitexture support (including combiners and dot product texture operations)
• Automatic mipmap generation
• Vertex buffer objects
• State queries
• User clip planes
• Greater control over point rendering
OpenGL ES 2.0
Android
2.0(NDK), 2.2
• Eliminates most of the fixed-function rendering pipeline in favor of a programmable one in a move similar to transition from OpenGL
3.0 to 3.1.
• Almost all rendering features of the transform and lighting stage, such as the specification of materials and light parameters formerly
specified by the fixed-function API, are replaced by shaders written by the graphics programmer.
• As a result, OpenGL ES 2.0 is not backward compatible with OpenGL ES 1.1.
OpenGL ES 3.0
Android 4.3
Samsung
S4(Snapdragon
)/Nexus5,
7(2013)/LG G2
OpenGL ES 3.0 is backwards compatible with OpenGL ES 2.0, enabling applications to incrementally add new visual features to
applications. OpenGL 4.3 provides full compatibility with OpenGL ES 3.0.
• Multiple enhancements to the rendering pipeline to enable acceleration of advanced visual effects including: occlusion queries,
transform feedback, instanced rendering and support for four or more rendering targets
• High quality ETC2 / EAC texture compression as a standard feature, eliminating the need for a different set of textures for each
platform
• A new version of the GLSL ES shading language[8] with full support for integer and 32-bit floating point operations
• Greatly enhanced texturing functionality including guaranteed support for floating point textures, 3D textures, depth textures, vertex
textures, NPOT textures, R/RG textures, immutable textures, 2D array textures, swizzles, LOD and mip level clamps, seamless cube
maps and sampler objects
• An extensive set of required, explicitly sized texture and render-buffer formats, reducing implementation variability and making it
much easier to write portable applications

25.
WebGL
• WebGL
– WebGL is based on OpenGL ES 2.0 and provides
an API for 3D graphics.
– Like OpenGL ES 2.0, WebGL does not have the
fixed-function APIs introduced in OpenGL 1.0 and
deprecated in OpenGL 3.0.
• Strictly speaking, WebGL is a dialect of OpenGL ES 2.0
– http://learningwebgl.com/lessons/

29.
GLSL keywords – attribute, uniform,
varying
• (Vertex) Attribute
– Vertex attributes are used to communicate from outside to the vertex shader.
• Unlike uniform variables, values are provided per vertex (and not globally for all vertices).
• There are built-in vertex attributes like the normal or the position, or you can specify
your own vertex attribute like a tangent or another custom value.
• Attributes can't be defined in the fragment shader.
• Uniform
– Uniform variables are used to communicate with your vertex or fragment
shader from "outside". In your shader you use the uniform qualifier to declare
the variable
• Uniform variables are read-only and have the same value among all processed vertices.
You can only change them within your C++ program.
• Varying
– Varying variables provide an interface between Vertex and Fragment Shader.
• Vertex Shaders compute values per vertex and fragment shaders compute values per
fragment.
• If you define a varying variable in a vertex shader, its value will be interpolated
(perspective-correct) over the primitive being rendered and you can access the
interpolated value in the fragment shader.