在OpenGL中使用四边形的奇怪条带

时间:2013-03-09 23:24:20

标签: java opengl antialiasing distortion

一切都在我刚刚拍摄的屏幕截图上...基本上,即使没有启用照明也会这样做...它是否与抗锯齿相关?

屏幕截图:http://i.imgur.com/Lrr29cL.png

@Axel,这是我的单个多维数据集的代码:

glBegin(GL_QUADS);

glColor3f(r,g,b);

glNormal3f(0, 0, -1);
glVertex3f(position.x + radius, position.y + radius, position.z - radius);
glVertex3f(position.x + radius, position.y - radius, position.z - radius);
glVertex3f(position.x - radius, position.y - radius, position.z - radius);
glVertex3f(position.x - radius, position.y + radius, position.z - radius);

glNormal3f(0, 0, 1);
glVertex3f(position.x + radius, position.y + radius, position.z + radius);
glVertex3f(position.x + radius, position.y - radius, position.z + radius);
glVertex3f(position.x - radius, position.y - radius, position.z + radius);
glVertex3f(position.x - radius, position.y + radius, position.z + radius);

glNormal3f(-1, 0, 0);
glVertex3f(position.x - radius, position.y + radius, position.z + radius);
glVertex3f(position.x - radius, position.y - radius, position.z + radius);
glVertex3f(position.x - radius, position.y - radius, position.z - radius);
glVertex3f(position.x - radius, position.y + radius, position.z - radius);

glNormal3f(1, 0, 0);
glVertex3f(position.x + radius, position.y + radius, position.z + radius);
glVertex3f(position.x + radius, position.y - radius, position.z + radius);
glVertex3f(position.x + radius, position.y - radius, position.z - radius);
glVertex3f(position.x + radius, position.y + radius, position.z - radius);

glNormal3f(0, -1, 0);
glVertex3f(position.x + radius, position.y - radius, position.z + radius);
glVertex3f(position.x - radius, position.y - radius, position.z + radius);
glVertex3f(position.x - radius, position.y - radius, position.z - radius);
glVertex3f(position.x + radius, position.y - radius, position.z - radius);

glNormal3f(0, 1, 0);
glVertex3f(position.x + radius, position.y + radius, position.z + radius);
glVertex3f(position.x - radius, position.y + radius, position.z + radius);
glVertex3f(position.x - radius, position.y + radius, position.z - radius);
glVertex3f(position.x + radius, position.y + radius, position.z - radius);

glEnd();

0 个答案:

没有答案