glReadPixels에서 컬러 첨부 파일을 읽을 수없는이 문제가 발생합니다. 내가 뭘하려고 오전glReadPixels of color 첨부 파일
:
읽기 작동 무엇 기본이 아닌 프레임 버퍼의 3 색 첨부 (아래 코드)
glFlush();
glFinish();
//binds my fbo with state GL_FRAMEBUFFER
RENDER_MANAGER.DeferredBuffer->bind();
unsigned char data[4];
glPixelStorei(GL_PACK_ALIGNMENT, 1);
unsigned int check = glGetError();
glReadBuffer(GL_COLOR_ATTACHMENT3);
glReadPixels(e->p->x, e->p->y, 1, 1,GL_RGB, GL_UNSIGNED_BYTE, data);
:
- 프레임 버퍼 모든 컬러 첨부 파일이 작동
- 3 번째 첨부 파일을 백 버퍼로 렌더링하고 화면에 표시하여 테스트했습니다. I 그것이 의도
glBindFramebuffer (GL_FRAMEBUFFER, _FBO)로 작동 앞에 버퍼 colorattachment 렌더링 후에 I glReadPixels 경우
/////create depth texture
glGenTextures(1, &_colorAttacherment[index]);
glBindTexture(GL_TEXTURE_2D, _colorAttacherment[index]);
glTexStorage2D(GL_TEXTURE_2D, 1, internalFormat, width, height);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filter);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrap);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrap);
////bind texture to the fbo
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + index, GL_TEXTURE_2D, _colorAttacherment[index], 0);
glBindFramebuffer(GL_FRAMEBUFFER, GL_NONE);
내 특정 문제는 색상 첨부를 읽는 glReadPixels을 얻는 중입니다.
OpenGL 오류가 있습니까? "* 프런트 버퍼에 colorattachment를 렌더링 한 후 glReadPixels를 사용하면 의도 한대로 작동합니다 *"첨부 파일이나 프론트 버퍼에서 읽는 중입니까? –
첨부 파일에서 읽으려고하지만 실 거예요. 프론트 버퍼에 첨부 파일을 렌더링 한 다음 프론트 버퍼를 읽을 수는 있지만 문제가 있습니다. 내가 확인하고 openGL 오류가 없습니다. –