0
我不知道这是深度缓冲区问题还是其他问题。我可以通过一个看到墙上而不是另一个:OpenGL:可以透过一面墙而不看到另一面
现在,当我旋转,使第二壁变得更加突出:
我有深度缓冲在Interface Builder中启用。我的OGL使得看起来像这样:
// enables
glEnable(GL_BLEND);
glEnable(GL_DEPTH_TEST);
glEnable(GL_SMOOTH);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
//glEnable(GL_CULL_FACE);
//glCullFace(GL_BACK);
glFrontFace(GL_CCW);
//glDepthMask(GL_TRUE);
//glDepthFunc(GL_LESS);
任何建议。我注意到其他使能,因为他们似乎没有帮助。
作为请求,这里是突起和模型视图设置:
// initialize all rotation matrices, translation matrix, and model view matrix to identity
rotateX = GLKMatrix4Identity;
rotateY = GLKMatrix4Identity;
rotateZ = GLKMatrix4Identity;
modelMat = GLKMatrix4Identity;
zNear = 0.1;
zFar = 1000.0;
frustumScale = 1.0;
//GLint maxbuffers;
//glGetIntegerv(GL_MAX_DRAW_BUFFERS, &maxbuffers);
//NSLog(@"Max. number of buffers: %d", maxbuffers);
// called?
NSLog(@"awakeFromNib called...");
// set the aspect ratio here
NSSize dim = [self frame].size;
aspectRatio = dim.width/dim.height;
// compute the projection matrix
projMat = GLKMatrix4MakePerspective(frustumScale, aspectRatio, zNear, zFar);
...
// compute the model matrix
GLKMatrix4 tempLeft = GLKMatrix4Multiply(rotateX, rotateY);
GLKMatrix4 tempRight = GLKMatrix4Multiply(rotateZ, translation);
modelMat = GLKMatrix4Multiply(tempLeft, tempRight);
你确定你实际上拥有一个深度缓冲区吗? – derhass
缺少深度缓冲区将是默认猜测 - 假定其上没有绿色的面被绘制第二个?鉴于您已经在IB中明确勾选并且您已启用,因此很难弄清楚发生了什么事情。如果使用'kCGLPFADepthSize'注销'CGGLescribePixelFormat'对'openglView.pixelFormat.CGLPixelFormatObj'的调用,你会得到什么? – Tommy
另外:考虑到你的几何体是凸的,启用glCullFace应该隐藏了问题(不解决它)。你确定启用是否被执行? – Tommy