4. Points
• point is represented by a set of floating-
point numbers called a vertex
4
glBegin(GL_POINTS);
glVertex2f(0.0, 0.0);
glVertex2f(0.0, 3.0);
glVertex2f(4.0, 3.0);
glVertex2f(6.0, 1.5);
glVertex2f(4.0, 0.0);
glEnd();
Budditha Hettige
22. Colors
• glColor3f(1.0, 0.0, 0.0);
– The current RGB color is red: full red, no green, no
blue.
– RGB Display Modes
22Budditha Hettige
23. Specifying a Color and a Shading
Model
• RGBA mode, use the glColor*() command to
select a current color.
– void glColor3{b s i f d ub us ui}(TYPE r, TYPE g, TYPE b);
– void glColor4{b s i f d ub us ui}(TYPE r, TYPE g, TYPE b, TYPE a);
– void glColor3{b s i f d ub us ui}v(const TYPE *v);
– void glColor4{b s i f d ub us ui}v(const TYPE *v);
23Budditha Hettige
24. Specifying a Shading Model
• single color (flat shading)
• many different colors (smooth shading, also called
Gouraud shading)
• void glShadeModel(GLenum mode);
– GL_SMOOTH (the default) or GL_FLAT.
– glShadeModel(GL_SMOOTH);
• Example:
– Shading.cpp
24Budditha Hettige