计算机图形学笔记之Bresenham直线光栅化算法
代码:
#include<GL/glut.h>
#include<iostream>
#include<math.h>
using namespace std;
#define PI 3.14
GLfloat pointsize = 1.0f;
int isign(int x)
{
if (x > 0)
return 1;
else if (x == 0)
return 0;
else return -1;
}
void lineBres(int x0, int y0, int xEnd, int yEnd)//起点坐标:(x0,y0),终点坐标(xEnd,yEnd)
{
int dx