#include "stdafx.h"
#include<windows.h>
#include"glut.h"
#include"gl.h"
#include<time.h>
#include<math.h>
int width = 500;
int height = 500;
int radius = 100;
float sangle, mangle, hangle;
char timebuffer[9];
int second, minute, hour;
void setTime();
void drawCircle();
void plotC(int x, int y, int cx, int cy, GLfloat *color);
void Bresenham_Circle_Algorithm(int cx, int cy, GLfloat *color);
void drawPoint();
void drawHour();
void drawMinute();
void drawSecond();
void display()
{
glClear(GL_COLOR_BUFFER_BIT);//清除颜色缓存
setTime();
drawCircle();
drawPoint();
drawHour();
drawMinute();
drawSecond();
glutSwapBuffers();//交换缓存
}
void timer(int value)
{
setTime();
glutPostRedisplay();
glutTimerFunc(500, timer, 1);
}
void reshape(int w, int h)
{
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if (w <= h)
gluOrtho2D(-radius,radius,-radius*h/w,radius*h/w);
else
gluOrtho2D(-radius*w / h, radius*w / h, -radius, rad
#include<windows.h>
#include"glut.h"
#include"gl.h"
#include<time.h>
#include<math.h>
int width = 500;
int height = 500;
int radius = 100;
float sangle, mangle, hangle;
char timebuffer[9];
int second, minute, hour;
void setTime();
void drawCircle();
void plotC(int x, int y, int cx, int cy, GLfloat *color);
void Bresenham_Circle_Algorithm(int cx, int cy, GLfloat *color);
void drawPoint();
void drawHour();
void drawMinute();
void drawSecond();
void display()
{
glClear(GL_COLOR_BUFFER_BIT);//清除颜色缓存
setTime();
drawCircle();
drawPoint();
drawHour();
drawMinute();
drawSecond();
glutSwapBuffers();//交换缓存
}
void timer(int value)
{
setTime();
glutPostRedisplay();
glutTimerFunc(500, timer, 1);
}
void reshape(int w, int h)
{
glViewport(0, 0, w, h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if (w <= h)
gluOrtho2D(-radius,radius,-radius*h/w,radius*h/w);
else
gluOrtho2D(-radius*w / h, radius*w / h, -radius, rad