【问题标题】:c++ opengl scan line algorithmc++ opengl扫描线算法
【发布时间】:2014-12-02 13:43:43
【问题描述】:

给定代码(取自Scan-line fill OpenGL/GLUT algorithm in C++):

void scanfill(float x1,float y1,float x2,float y2,float x3,float y3,float x4,float y4)
{
    int le[500],re[500],i,j;

    for(i=0;i<500;i++)
        le[i]=500,re[i]=0;

    edgedetect(x1,y1,x2,y2,le,re);
    edgedetect(x2,y2,x3,y3,le,re);
    edgedetect(x3,y3,x4,y4,le,re);
    edgedetect(x4,y4,x1,y1,le,re);

    for(j=0;j<500;j++)
    {
        if(le[j]<=re[j])
            for(i=le[j];i<re[j];i++)
                draw_pixel(i,j);
    }
}

re[500]le[500] 数组是什么?为什么是 500?

【问题讨论】:

    标签: c++ opengl scanline


    【解决方案1】:

    它们是左右边缘缓冲区。它们存储要在每个水平扫描线上填充的最小和最大 X 坐标。

    500 只是glutInitWindowSize(500,500); 中指定的窗口高度。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-04-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-12-13
      • 1970-01-01
      相关资源
      最近更新 更多