#include<windows.h>
#include<gl.h>
#include<glu.h>
#include<glut.h>
#include <math.h>
void Display ()
{ glClear(GL_COLOR_BUFFER_BIT);
GLUquadricObj
* quadricObj; //Creates
a quadratic object
quadricObj
= gluNewQuadric(); //Sets
a pointer to a new quadratic object
gluQuadricDrawStyle(quadricObj,
GLU_FILL);
glColor3f
(0.0, 1.0, 0.0); //Sets
ellipse color to green
glScalef(0.7,
1.5, 1.0); //Scales
the ellipse
//glColor3f
(1.0, 0.0, 0.0); //Red
ellipse
//glScalef(1.4,
0.7, 1.0);
//glColor3f
(0.0, 0.0, 1.0); //Blue
ellipse
//glScalef(0.4,
1.6, 1.0);
gluDisk(quadricObj,
0.0, 3.0, 100, 100); //Sets the ellipse
properties
glFlush();
}
void init()
{
glClearColor(0.0,
0.0, 0.0, 0.0); //Sets background color
to black
glMatrixMode(
GL_PROJECTION);
glLoadIdentity();
glOrtho(-8.0,
8.0, -8.0, 8.0, -8.0, 8.0);
}
void main( int argc, char **argv)
{
glutInit
( &argc, argv);
glutInitDisplayMode(GLUT_SINGLE
| GLUT_RGB);
glutInitWindowSize(
300, 300);
glutInitWindowPosition(
200, 200);
glutCreateWindow("Ellipses");
init();
glutDisplayFunc(
Display );
glutMainLoop();
}
No comments:
Post a Comment