OUTPUT PRIMITIVES

  • Basic structure
glBegin (mode);
glVertex* (…);
//Triangle=3Vertex, Quads=4Vertex etc
glVertex* (…);
glEnd ();

  • POINTS: one vertex
glBegin(GL_POINTS);
glVertex2f(x1, y1);
glEnd();

  • LINES:two vertex(starting and ending point)
glBegin(GL_LINES);
glVertex2f(x1, y1);
glVertex2f(x2, y2);
glEnd();

  • LINE STRIP
glBegin(GL_LINE_STRIP);
glVertex2f(x1, y1);
glVertex2f(x2, y2);
glVertex2f(x3, y3);
glEnd();

  • LINE LOOP
glBegin(GL_LINE_LOOP);
glVertex2f(x1, y1);
glVertex2f(x2, y2);
glVertex2f(x3, y3);
glEnd();

  • TRIANGLES: cconcist of 3 vertex
glBegin(GL_TRIANGLES);
glVertex2f(x1, y1);
glVertex2f(x2, y2);
glVertex2f(x3, y3);
glEnd();

  • TRIANGLE STRIP
glBegin(GL_TRIANGLE_STRIP);
glVertex2f(x1, y1);
glVertex2f(x2, y2);
glVertex2f(x3, y3);
glVertex2f(x4, y4);
glEnd();

  • TRIANGLE FAN
glBegin(GL_TRIANGLE_FAN);
glVertex2f(x1, y1);
glVertex2f(x2, y2);
glVertex2f(x3, y3);
glVertex2f(x4, y4);
glEnd();

  • QUADS: consist of 4 vertex
glBegin(GL_QUADS);
glVertex2f(x1, y1);
glVertex2f(x2, y2);
glVertex2f(x3, y3);
glVertex2f(x4, y4);
glEnd();

  • QUAD STRIP
glBegin(GL_QUAD_STRIP);
glVertex2f(x1, y1);
glVertex2f(x2, y2);
glVertex2f(x3, y3);
glVertex2f(x4, y4);
glVertex2f(x5, y5);
glVertex2f(x6, y6);
glEnd();

  • POLYGON
glBegin(GL_POLYGON);
glVertex2f(x1, y1);
glVertex2f(x2, y2);
glVertex2f(x3, y3);
glVertex2f(x4, y4);
glVertex2f(x5, y5);
glEnd();

Comments

Popular posts from this blog

OPENGL COLOR CODES

OpenGL Texture

Draw Circle in OpenGL