Computer Graphics

OpenGL Point Functions

➢ The type within glBegin() specifies the type of the object and its value can be as follows: GL_POINTS

➢ Each vertex is displayed as a point.

➢ The size of the point would be of at least one pixel.

➢ Then this coordinate position, along with other geometric descriptions we may have in our scene, is passed to the viewing routines.

➢ Unless we specify other attribute values, OpenGL primitives are displayed with a default size and color.

The default color for primitives is white, and the default point size is equal to the size of a single screen pixel 

Syntax:

Case 1:

glBegin (GL_POINTS);

glVertex2i (50, 100);

glVertex2i (75, 150);

glVertex2i (100, 200);

glEnd ( );

[wp_ad_camp_1]
Case 2:

➢ we could specify the coordinate values for the preceding points in arrays such as

int point1 [ ] = {50, 100};

int point2 [ ] = {75, 150};

int point3 [ ] = {100, 200};

and call the OpenGL functions for plotting the three points as

glBegin (GL_POINTS);

glVertex2iv (point1);

glVertex2iv (point2);

glVertex2iv (point3);

glEnd ( );

[wp_ad_camp_1]
Case 3:

➢ specifying two point positions in a three dimensional world reference frame. In this case, we give the coordinates as explicit floating-point values:

glBegin (GL_POINTS); 

glVertex3f (-78.05, 909.72, 14.60); 

glVertex3f (261.91, -5200.67, 188.33); 

glEnd ( );

Leave a comment

Your email address will not be published. Required fields are marked *