Download presentation
Presentation is loading. Please wait.
Published byIlene Bruce Modified over 9 years ago
1
CMPE 466 COMPUTER GRAPHICS Chapter 5 Attributes of Graphics Primitives Instructor: D. Arifler Material based on - Computer Graphics with OpenGL ®, Fourth Edition by Donald Hearn, M. Pauline Baker, and Warren R. Carithers - Fundamentals of Computer Graphics, Third Edition by by Peter Shirley and Steve Marschner 1
2
State system or state machine and attributes A graphics system maintains a list for the current values of attributes and other parameters Attributes are referred to as state variables or parameters Examples of attributes Color Size All OpenGL state parameters have default values Parameters remain in effect until new values are specified 2
3
RGB color 3 Grayscale: When RGB color settings specify an equal amount of R, G, and B, the result is the some shade of gray
4
Color lookup table or color map 4 Figure 5-1 A color lookup table with 24 bits per entry that is accessed from a frame buffer with 8 bits per pixel. A value of 196 stored at pixel position (x, y) references the location in this table containing the hexadecimal value 0x0821 (a decimal value of 2081). Each 8-bit segment of this entry controls the intensity level of one of the three electron guns in an RGB monitor. Extended color capability with less memory requirement
5
Other color parameters Intensity Quantifies the amount of light energy radiating in a particular direction over a period of time (physical) Luminance Characterizes the perceived brightness of light (psychological) 5
6
OpenGL color functions Specifying a single frame buffer and RGB mode Selecting the current color Selecting display window color 6
7
OpenGL point-size function 7
8
OpenGL line-style function glLineStipple (repeatFactor, pattern); “pattern” references a 16-bit integer A 1 denotes an on pixel position, a 0 denotes an off pixel position Default value is 0xFFFF “repeatFactor” specifies how many times each bit in the pattern is to be repeated before the next bit in the pattern is applied Default value is 1 8
9
OpenGL line-width and line-style functions /* Define a two-dimensional world-coordinate data type. */ typedef struct { float x, y; } wcPt2D; wcPt2D dataPts [5]; void linePlot (wcPt2D dataPts [5]) { int k; glBegin (GL_LINE_STRIP); for (k = 0; k < 5; k++) glVertex2f (dataPts [k].x, dataPts [k].y); glFlush ( ); glEnd ( ); } /* Invoke a procedure here to draw coordinate axes. */ glEnable (GL_LINE_STIPPLE); /* Input first set of (x, y) data values. */ glLineStipple (1, 0x1C47); // Plot a dash-dot, standard-width polyline. linePlot (dataPts); /* Input second set of (x, y) data values. */ glLineStipple (1, 0x00FF); // Plot a dashed, double- width polyline. glLineWidth (2.0); linePlot (dataPts); /* Input third set of (x, y) data values. */ glLineStipple (1, 0x0101); // Plot a dotted, triple- width polyline. glLineWidth (3.0); linePlot (dataPts); glDisable (GL_LINE_STIPPLE); 9
10
Line-attribute functions 10 Figure 5-3 Plotting three data sets with three different OpenGL line styles and line widths: single-width dash-dot pattern, double-width dash pattern, and triple-width dot pattern.
11
OpenGL fill-area functions 11 … Specification of vertices of polygon …
12
Texture and interpolation patterns 12 // Shading mode (default)
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.