360
Graphics Pipline
WebGL Primitives
-
GL_POINTS
Each vertex is rendered as a single point. No connections between points.
Example: A scatter plot. -
GL_LINES
Vertices are paired up to form individual straight-line segments.
Example: Two vertices form one line, four vertices form two lines. -
GL_LINE_STRIP
Vertices are connected in sequence to form a continuous polyline.
Example: A line that passes through multiple points without breaks. -
GL_LINE_LOOP
Similar toGL_LINE_STRIP
, but the last vertex is connected back to the first, forming a closed loop. -
GL_TRIANGLES
Every three consecutive vertices form an independent triangle.
Example: For six vertices, two triangles are rendered. -
GL_TRIANGLE_STRIP
A series of connected triangles, where each new vertex after the first two forms a new triangle with the previous two vertices.
Example: Efficient for rendering long strips of triangles. -
GL_TRIANGLE_FAN
A set of triangles sharing a common center vertex (first vertex). Each subsequent vertex, combined with the center and the previous vertex, forms a new triangle.
Example: Useful for circular or fan-shaped surfaces.
WebGL Program = Vertex Shader + Fragment Shader