-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrangle.cpp
More file actions
60 lines (52 loc) · 1.22 KB
/
trangle.cpp
File metadata and controls
60 lines (52 loc) · 1.22 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
49
50
51
52
53
54
55
56
57
58
59
60
#include<GL/glut.h>
#include<string.h>
void displayText( )
{
const char *str="Simple triangle";
int j = strlen( str );
glColor3f( 0.7, 0.0, 1.0 );
glRasterPos2f( -0.2, -0.8 );
for( int i = 0; i < j; i++ )
{
glutBitmapCharacter( GLUT_BITMAP_TIMES_ROMAN_24, str[i] );
}
const char *str2="Shubhankar Nath R134214062";
j = strlen( str2 );
glColor3f( 0.2, 0.5, 1.0 );
glRasterPos2f( -0.9, 0.9 );
for( int i = 0; i < j; i++ )
{
glutBitmapCharacter( GLUT_BITMAP_TIMES_ROMAN_24, str2[i] );
}
}
void display()
{
glClear(GL_COLOR_BUFFER_BIT);
glClearColor(0.2f, 0.2f, 0.2f, 0.2f);
glBegin(GL_POLYGON);
glColor3f(0, 0.5, 0) ;
glVertex2f(-0.4, 0.5);
glVertex2f(0, -0.2);
glVertex2f(-0.8, -0.2);
glEnd();
glBegin(GL_POLYGON);
glColor3f(0, 0.5, 0);
glVertex2f(0.5, 0.5);
glColor3f(0.5, 0, 0);
glVertex2f(0.9, -0.2);
glColor3f(0, 0, 0.5);
glVertex2f(0.1, -0.2);
glEnd();
displayText();
glFlush();
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowPosition(80, 80);
glutInitWindowSize(800, 800);
glutCreateWindow("Simple Triangle");
glutDisplayFunc(display);
glutMainLoop();
}