//drawDot //drawing dots with the given function drawDot() // T. Kosaka CS TNCT 2001 #include #include #include void setColor(float red,float green,float blue) { glColor3f(red, green, blue); } void drawDot(int x,int y) { glBegin(GL_POINTS); glVertex2i(x, y); glEnd(); } void userdraw(void); void display(void) { glClear( GL_COLOR_BUFFER_BIT); userdraw(); glutSwapBuffers(); } void userdraw(void) { setColor(1,1,1); drawDot(50,400); drawDot(50,350); drawDot(50,300); drawDot(100,400); drawDot(100,350); } int main(int argc, char **argv) { glutInit(&argc,argv); glutInitDisplayMode ( GLUT_DOUBLE | GLUT_RGB ); glutInitWindowPosition(100,100); glutInitWindowSize(640,480); glutCreateWindow ("putPixel"); glClearColor(0.0, 0.0, 0.0, 0.0); gluOrtho2D(0., 640., 0.0, 480.0); // Define the dimensions of the Orthographic Viewing Volume glutDisplayFunc(display); glutMainLoop(); return 0; }