-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathFirst_Program.c
57 lines (36 loc) · 849 Bytes
/
First_Program.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include<stdio.h>
#include<GL/glut.h>
#include<math.h>
void Init(){
glClearColor(0.0,0.0,0.0,0);
glColor3f(0.0,1.0,0.0);
gluOrtho2D(0,640,0,480);
}
void display_point(){
//Clear Buffer
glClear(GL_COLOR_BUFFER_BIT);
//Plot pixel
glBegin(GL_POINTS);
glVertex2d(100,100);
glEnd();
//Clear the flush
glFlush();
}
int main(int argc, char **argv){
//Initilise GLUT library
glutInit(&argc,argv);
//Set initial disllay mode
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
//Set initial windpw position & size
glutInitWindowPosition(0,0);
glutInitWindowSize(640,480); //Width, Height
/*Create window with title*/
glutCreateWindow("PLOT");
//Initialise Drawing colours
Init();
//Call the display function
glutDisplayFunc(display_point);
//Keep displaying until program exit
glutMainLoop();
return 0;
}