-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrectangle.cpp
More file actions
49 lines (45 loc) · 1.05 KB
/
rectangle.cpp
File metadata and controls
49 lines (45 loc) · 1.05 KB
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
/// In the name of ALLAH , the Beneficent , the Merciful ///
#include <iostream>
#include <stdio.h>
#include <cstring>
#include<windows.h>
#include <GL/glut.h>
void init(void) {
glClearColor(0.0, 0.0, 0.0, 0.0);
glMatrixMode(GL_PROJECTION);
gluOrtho2D(0.0, 400.0, 0.0, 400.0);
}
void Rectangle__ (void) {
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(0.0, 0.0, 1.0);
glPointSize(5.0);
glColor3f(1.0, 0.0, 0.0);
glBegin(GL_LINES);
glVertex2i(100, 200);
glVertex2i(100, 50);
glVertex2i(100, 50);
glVertex2i(300, 50);
glVertex2i(300, 50);
glVertex2i(300, 200);
glVertex2i(300, 200);
glVertex2i(100, 200);
glVertex2i(400, 50);
glVertex2i(600, 50);
glVertex2i(500, 300);
glVertex2i(400, 50);
glVertex2i(400, 300);
glVertex2i(600, 50);
glEnd();
glFlush();
}
int main(int argc, char* argv[]) {
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB);
glutInitWindowPosition(50, 100);
glutInitWindowSize(640 , 480);
glutCreateWindow("rectangle_drawing");
init();
glutDisplayFunc(Rectangle__);
glutMainLoop();
return 0;
}