Color and Color Models Angel 2 5 Angel














- Slides: 14
Color and Color Models Angel 2. 5 Angel: Interactive Computer Graphics 5 E © Addison-Wesley 2009 1
COLOR Angel: Interactive Computer Graphics 5 E © Addison-Wesley 2009 2
Color Distribution Angel: Interactive Computer Graphics 5 E © Addison-Wesley 2009 3
Color Formation Angel: Interactive Computer Graphics 5 E © Addison-Wesley 2009 4
Color Values Angel: Interactive Computer Graphics 5 E © Addison-Wesley 2009 5
HSV Cone http: //en. wikipedia. org/wiki/Image: HSV_cone. jpg Angel: Interactive Computer Graphics 5 E © Addison-Wesley 2009 6
CIE 1931 color space chromaticity diagram http: //en. wikipedia. org/wiki/Image: CIExy 1931. svg Angel: Interactive Computer Graphics 5 E © Addison-Wesley 2009 7
Color Gamut Angel: Interactive Computer Graphics 5 E © Addison-Wesley 2009 8
Attributes • Attributes are part of the Open. GL state and determine the appearance of objects – Color (points, lines, polygons) – Size and width (points, lines) – Stipple pattern (lines, polygons) – Polygon mode • Display as filled: solid color or stipple pattern • Display edges • Display vertices Angel: Interactive Computer Graphics 5 E © Addison-Wesley 2009 9
Open. GL Attribute API • • gl. Line. Width(w); gl. Point. Size(w); gl. Clear. Color(r, g, b, a); gl. Color 3 f(r, g, b); Angel: Interactive Computer Graphics 5 E © Addison-Wesley 2009 10
RGB color • Each color component is stored separately in the frame buffer • Usually 8 bits per component in buffer • Note in gl. Color 3 f the color values range from 0. 0 (none) to 1. 0 (all), whereas in gl. Color 3 ub the values range from 0 to 255 Angel: Interactive Computer Graphics 5 E © Addison-Wesley 2009 11
Indexed Color • Colors are indices into tables of RGB values • Requires less memory – indices usually 8 bits – not as important now • Memory inexpensive • Need more colors for shading Angel: Interactive Computer Graphics 5 E © Addison-Wesley 2009 12
Color and State • The color as set by gl. Color becomes part of the state and will be used until changed – Colors and other attributes are not part of the object but are assigned when the object is rendered • We can create conceptual vertex colors by code such as gl. Color gl. Vertex Angel: Interactive Computer Graphics 5 E © Addison-Wesley 2009 13
Smooth Color • Default is smooth shading – Open. GL interpolates vertex colors across visible polygons • Alternative is flat shading – Color of first vertex determines fill color • gl. Shade. Model (GL_SMOOTH) or GL_FLAT Angel: Interactive Computer Graphics 5 E © Addison-Wesley 2009 14