Points |
The Glide function grDrawPoint() renders a single point to the screen.
The point will be treated as a triangle with nearly coincident vertices (that is, a very small triangle) for rendering purposes. If many points will be rendered, noticeable performance improvement can be achieved by writing pixels directly to the frame buffer. (grDrawPoint() send three vertices per point to the hardware and iterates along three edges; only one linear frame buffer write per point is required.)
void grDrawPoint( const GrVertex *a ) |
Example . A thousand points of light.This code fragment clears the screen to black and then draws a thousand random points. By default, the rendering buffer is set to GR_BUFFER_BACKBUFFER and the color buffer is writable. The color white is made by specifying maximal values for red, green, an d blue, and a quick way to do that is ~0. Some of the points will be clipped out: the random number generator selects point with co-ordinates in the range [ 0..1024 ); the screen resolution is less than that. By default, the clipping window is set to the screen size.
int n;
GrVertex p; /* clear the back buffer to black */
/* set color to white */
grConstantColorValue(~0); /* generate and draw 1000 random points */
|