Function


Buffer

  • glClearBuffer
1
void glClearBufferfv (GLenum buffer, GLint drawBuffer, const GLfloat *value);

clear buffer of drawBuffer with value


Shader & Program object manage

  • glCreateShader
1
GLuint glCreateShader (GLenum type);

create type of shader(structure that manage shader code compile and linking it) and return GLuint as identifier.

  • glShaderSource
1
void glShaderSource (GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length);

will add more explains

  • glCompileShader
1
void glCompileShader (GLuint shader);

Compile shader indenfied shader.

  • glCreateProgram
1
GLuint glCreateProgram (void);

create a program object and return its identifier.

  • glAttachShader
1
void glAttachShader (GLuint program, GLuint shader);

attach shader to program

  • glLinkProgram
1
void glLinkProgram (GLuint program);

as its name

  • glDeleteShader
1
void glDeleteShader (GLuint shader);

as its name

  • glDeleteProgram
1
void glDeleteProgram (GLuint program);

as its name


Vertex Shader manage

Vertex Array

  • glGenVertexArrays
1
void glGenVertexArrays (GLsizei n, GLuint *arrays);

Generate n number of VAO(Vertex Array Object)s in arrays.
since this function access GLuint as array, it requires arrays' address as parameter.

  • glBindVertexArray
1
void glBindVertexArray (GLuint array);

bind array(VAO) to current context.

ood

  • glDrawArrays
1
void glDrawArrays (GLenum mode, GLint first, GLsizei count);

send vertices to pipeline. started from first, count of vertices with premitive mode
mode example: GL_POINTS, GL_LINES, GL_TRIANGLES, GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, GL_PATCHES, …

  • glVertexAttrib
1
void glVertexAttrib4fv(GLuint index, const GLfloat *v);

set 4fv of vertex attribute to layout(loaction = index).
4fv means 4 float vector(array)


Tessellation Shader manage

  • glPatchParameteri
1
void glPatchParameteri (GLenum pname, GLint value);

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 from first , 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


1
EmitVertex()

make vertex with gl_Position of geometry shader

1
EndPrimitive()

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
1
float floor (float f);

floor function in glsl.
i.e. return integer part of f.
trunc funtion is used in absolute value’s case.

  • fract
1
float fract (float f);

return fractional part of f.

  • mix
1
vec4 mix (vec4 A, vec4 B, float t);

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.

================================================================