2013-10-02 4 views
0

이것이 깊이 버퍼 문제인지 다른 문제인지는 잘 모릅니다. 나는 하나의 벽을 통해 볼 수 있지만 다른 :OpenGL : 한 벽을 통해 볼 수 있지만 다른 벽을 볼 수는 없습니다.

enter image description here

enter image description here

내가 깊이 버퍼를 가지고 : 이제

Wall viewable

을 나는 회전 할 때 그렇게 두 번째 벽은 더욱 두드러된다 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); 
+0

실제로 깊이 버퍼가 있습니까? – derhass

+0

누락 된 깊이 버퍼가 기본 추측이됩니다. 녹색이없는 얼굴이 두 번째로 그려진다고 가정하십시오. IB에서 명시 적으로 체크 된 것을 얻었고 어떤 일을 할 수 있었는지에 관해서는 어떤 일이 일어나고 있는지 파악하기가 어렵습니다. 'kGLPFADepthSize'를 사용하여'openglView.pixelFormat.CGLPixelFormatObj'에'CGLDescribePixelFormat' 호출을 로그 아웃하면 어떻게됩니까? – Tommy

+0

또한 glCullFace를 사용하면 지오메트리가 볼록하다는 점을 감안할 때 glCullFace가 문제를 숨겨서는 안됩니다 (해결하지 않고). 활성화가 전혀 수행되지 않았습니까? – Tommy

답변

0

그것을 해결 !!!!

Interface Builder를 통해 심도 버퍼를 설정하는 것이 효과가없는 것으로 보입니다. 프로그래밍 방식으로 설정해야했고 문제가 해결되었습니다.

NSOpenGLPixelFormatAttribute attribute[] = {NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core, NSOpenGLPFADepthSize, (NSOpenGLPixelFormatAttribute)24, 0};