我有一个简单的程序来使用一系列使用过剩的矩形来渲染表格..但是它没有按照我的预期显示.....有人能告诉我哪里出错了吗? #define s 0.15
void image() {
if (r==0) glColor3f(0.6, 0.6, 0.6);
else if (log2(r) >=8) glColor3f(log2(r) + 2, log2(r) + 2, log2(r) + 2);
else glColor3f(log2(r), log2(r), log2(r));
convert(r);
glVertex3f(x, y, 0);
glVertex3f(x, y - s-0.1, 0);
glVertex3f(x + s, y - s-0.1, 0);
glVertex3f(x + s, y, 0);
}
void render() {
glClearColor(0.3, 0.2, 0.3, 1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBegin(GL_POLYGON);
y=0.9;
glLoadIdentity();
for (i=0;
i<n;
i++, y -=s + 0.2) {
x=-0.95;
for (j=0;
j < n;
j++, x +=s + 0.07) {
r=a[i][j];
image();
}
}
glEnd();
glutSwapBuffers();
}