#include<windows.h>
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<GL/gl.h>
#include<GL/glu.h>
#include<GL/glaux.h>
#define MY_Circle 1
#define PI 3.1415926535898
void CALLBACK reshape(int width,int height);
void CALLBACK draw(void);
void CALLBACK reshape(int width,int height){
glViewport(0,0,(GLint)width,(GLint)height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(-8.0,8.0,-8.0,8.0,-8.0,8.0);
glMatrixMode(GL_MODELVIEW);
}
void CALLBACK draw(void){
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glTranslatef(-3.5,3.5,0.0);
glScalef(2.0,2.0,1.0);
glColor3f(1.0,.0,1.0);
glCallList(MY_Circle);
glLoadIdentity();
glTranslatef(3.5,3.5,0.0);
glRotatef(30.0,1.0,0.0,0.0);
glColor3f(0.0,0.0,1.0);
glCallList(MY_Circle);
glLoadIdentity();
glTranslatef(-3.5,-3.5,0.0);
glRotatef(45.0,1.0,0.0,0.0);
glRotatef(45.0,0.0,1.0,0.0);
glRotatef(45.0,0.0,0.0,1.0);
glScalef(2.0,1.0,1.0);
glColor3f(0.0,1.0,0.0);
glCallList(MY_Circle);
glLoadIdentity();
glTranslatef(3.5,-3.5,0.0);
glScalef(1.0,4.0,1.0);
glColor3f(0.0,1.0,0.0);
glCallList(MY_Circle);
glFlush();
}
void make_circle(){
GLint i;
GLfloat cosine,sine;
glNewList(MY_Circle,GL_COMPILE);
glBegin(GL_POLYGON);
for(i=0;i<100;i++){
cosine =cos(i*2*PI/100.0);
sine = sin(i*2*PI/100.0);
glVertex2f(cosine,sine);
}
glEnd();
glEndList();
}
void main(int argc,char**argv){
auxInitPosition(0,0,500,500);
auxInitDisplayMode(AUX_RGB|AUX_DEPTH);
auxInitWindow("Circle_List");
glClearColor(0.0,0.0,0.0,0.0);
glShadeModel(GL_FLAT);
glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
glEnable(GL_DEPTH_TEST);
make_circle();
auxReshapeFunc(reshape);
auxMainLoop(draw);
}