- Basic Concept
1.1GLES 1.1 - Chapter 2.6
In the GL, geometricobjects are drawn by specifying a series of coordinate sets
that include vertices and optionally normals, texture coordinates,and colors.
Seven geometricobjects that are drawn this way: points (including point sprites), connectedline segments (line strips), line segment loops, separated line segments,triangle strips, triangle fans, and separated triangles.
A color isassociated with each vertex. This color is either based on the current color orproduced by lighting, depending on whether or not lighting is enabled.
Thevertices defining a primitiveto be rasterized have texture coordinates and color associated with them.
1.2 VertexArrays (s for multiple array[])
Vertexdata is placed into arrays stored in the client’s address space. (CPU side RAM)
Theclient may specify up to four plus the value of MAX TEXTURE UNITS arrays: oneeach to store vertex coordinates, normals, colors, point sizes, and one or moretexture coordinate sets.
1.3Coordinates
- Pipeline Inside
- Lighting
LightProperty (Direction, reflection and color)
TheOpenGL lighting model considers the lighting to be divided into fourindependent components: emissive, ambient, diffuse, and specular.
Allfour components are computed independently and then added together.
Alighting parameter is of one of five types: color,position, direction, real, or boolean.
MaterialProperty (Color)
TheOpenGL lighting model makes the approximation that a material's color dependson the percentages of the incoming red, green, and blue light it reflects.
Likelights, materials have different ambient, diffuse, and specular colors, whichdetermine the ambient, diffuse, and specular reflectances of thematerial.
Inother words, if an OpenGL light has components (LR, LG, LB), and a material hascorresponding components (MR, MG, MB), then, ignoring all other reflectivityeffects, the light that arrives at the eye is given by (LR*MR, LG*MG, LB*MB).
- Rasterization
4.1overview (Chapter 3)
Rasterizationis the process by which a primitive is converted to a two-dimensional image.
Eachpoint of this image contains such information as color and depth.
Thus,rasterizing a primitive consists of two parts.
Thefirst is to determine which squares of an integer grid in window coordinatesare occupied by the primitive.
Thesecond is assigning a color and a depth value to each such square.
Theresults of this process are passed on to the next stage of the GL (per-fragmentoperations), which uses the information to update the appropriate locations inthe framebuffer.
Agrid square along with its parameters of assigned colors, z (depth), andtexture coordinates is called a fragment;
theparameters are collectively dubbed the fragment’s associated data. A fragmentis located by its lower left corner, which lies on integer grid coordinates.Rasterization operations also refer to a fragment’s center, which is offset by(1=2; 1=2) from its lower left corner (and so lies on half-integercoordinates).
4.2MSAA
https://learnopengl.com/#!Advanced-OpenGL/Anti-Aliasing
4.3 Points
Oddwidth - centered at ([x]+0.5, [y]+0.5), with width=odd width+0.5. (cause it isnot possible to draw a point with exact odd width while centered at integerpoint).
Evenwidth - centered at ([x+0.5], [y+0.5]), with width = even width.
4.4Line
4.5Polygon
4.6Pixel Rectangle
4.7Texturing
Texturingmaps a portion of one or more specified images onto each primitive for whichtexturing is enabled. This mapping is accomplished by using the color of animage at the location indicated by a fragment’s (s; t) coordinates to modifythe fragment’s RGBA color.
voidTexImage2D( enum target, int level,
intinternalformat, sizei width, sizei height,
intborder, enum format, enum type, void *data );
4.8Mipmaps
Theproblem is with animation. When you slowly zoom out on a texture, you start tosee aliasing artifacts appear. These are caused by sampling fewer than all ofthe texels; the choice of which texels are sampled changes between differentframes of the animation.
Theseare pre-shrunk versions of the full-sized image. Each mipmap is half the sizeof the previous one in the chain, using the largest dimension of the image . Soa 64x16 2D texture can have 6 mip-maps: 32x8, 16x4, 8x2, 4x1, 2x1, and 1x1.OpenGL does not require that the entire mipmap chain is complete; you canspecify what range of mipmaps in a texture are available.
From <https://www.khronos.org/opengl/wiki/Texture#Mip_maps>
4.9fogs
Ifenabled, fog blends a fog color with a rasterized fragment’s post-texturingcolor using a blending factor f.
C= fCr + (1 - f)Cf ;
5 Framebufferoperation