Function
Buffer
- glClearBuffer
|
|
clear
buffer
ofdrawBuffer
withvalue
Shader & Program object manage
- glCreateShader
|
|
create
type
of shader(structure that manage shader code compile and linking it) and returnGLuint
as identifier.
- glShaderSource
|
|
will add more explains
- glCompileShader
|
|
Compile
shader
indenfied shader.
- glCreateProgram
|
|
create a program object and return its identifier.
- glAttachShader
|
|
attach
shader
toprogram
- glLinkProgram
|
|
as its name
- glDeleteShader
|
|
as its name
- glDeleteProgram
|
|
as its name
Vertex Shader manage
Vertex Array
- glGenVertexArrays
|
|
Generate
n
number of VAO(Vertex Array Object)s inarrays
.
since this function access GLuint as array, it requiresarrays
' address as parameter.
- glBindVertexArray
|
|
bind
array
(VAO) to current context.
ood
- glDrawArrays
|
|
send vertices to pipeline. started from
first
,count
of vertices with premitivemode
mode example: GL_POINTS, GL_LINES, GL_TRIANGLES, GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, GL_PATCHES, …
- glVertexAttrib
|
|
set 4fv of vertex attribute to layout(loaction =
index
).
4fv means 4 float vector(array)
Tessellation Shader manage
- glPatchParameteri
|
|
tname example: GL_PATCH_VETICES
Geometry Shader manage
Shader Built-in variable
- gl_Position
(out) represents transform of vertex
- gl_VertexID
specify id used in vertex shader
(in) Ex: glDrawArrays) started fromfirst
,count
number of vertex
- gl_InvocationID
(in) used fo 0-based index of gl_in, gl_out
- gl_TessLevelInner
- gl_TessLevelOuter
(out) Tessellation factor variable array
contain tessellation level
- gl_TessCoord
(in)barycentric coodinate of vertex
|
|
make vertex with gl_Position of geometry shader
|
|
automatically called when geometry shader end
- gl_FragCoord
(in)coordinate of fragment to manipulate
General
- gl_in
- gl_out
not simple variable, but array
- floor
|
|
floor function in glsl.
i.e. return integer part of f
.
trunc
funtion is used in absolute value’s case.
- fract
|
|
return fractional part of f
.
- mix
|
|
linear interpolation.
has sevelar verstions take different dimensional vectors or scalars as A
and B
,
t
shows iterpolating parameter represented by scalar or matching vector.
layout
-
Vertex
layout (location = 0) in vec4 variablename;
//location used as attribute index -
Tesselation Control
layout (vertices = 3) out;
//output control point(vertices) per patch -
Tesselation Evaluation
layout (triangles, equal_spacing, cw) in;
//setting for tessellation mode -
Geometry
layout (triangles) in;
layout (points, max_vertices = 3) out;
//get input as triangle and divide them into points -
Fragment
-
Compute
layout (local_size_x = 32, local_size_y = 32) in;
//local workgroup szie is 32*32
extension
#extension GL_extension_feature_en : enable //enable feature both device support it or not
#extension GL_extension_feature_re : required //if this extensio is not replaceable, use required for assertive code
#if GL_extension_feature_en
//extension's name will be defined with macro so you can manage code
#else
//alternative codes if extension doesn't supported
#endif
Fixed Block
Pixel Operations
scissor test => stencil test => depth test =>
Coordinate space
-
Model space (=object space)
local origin following coordinate space -
World space
global origin following coordinate space -
View space (=camera, =eye space)
relative coordinate space to viewer -
Clip space
coordniate space after projection on homogeneous coordinate -
Normalized device coordinate(NDC) space
coordinate space after dividing clip space by w component -
Window space
window origin following coordinate space
Transform
- View - Clip Transform
can be performed by projection matrix : orthographic, perspective, etc…
occurs after Model - View Transform.
================================================================