Programming/openGL2022. 11. 17. 17:49

wayland / weston 에서 glReadPixels를 통해 읽어 오는게 실패해서 찾아보니

glUserProgram()을 하면 된다는데.. 문제는 어떤 컨텍스트의 정보를 어떻게 받아오냐 일 듯..

 

glPixelStorei(GL_PACK_ALIGNMENT, 1);
glReadPixels(0, 0, output->width, output->height, GL_RGBA, GL_UNSIGNED_BYTE, data);

[링크 : https://github.com/ereslibre/wayland/blob/master/compositor/screenshooter.c]

 

It's an error to call anything but a very limited set of functions between glBegin and glEnd. That list is mostly composed of functions related to specifying attributes of a vertex (e.g., glVertex, glNormal, glColor, glTexCoord, etc.).

So, if your OpenGL implementation is following the OpenGL specification, glReadPixels should return immediately without executing because of being called within a glBegin/glEnd group. Remove those from around your calls, and glReadPixels should work as expected.

[링크 : https://stackoverflow.com/questions/19351568/glreadpixels-doesnt-work]

 

I figured it out. All I had to do was add glUseProgram(0) at the very end of the draw cylinder function. After more than 3 weeks of looking into this.

[링크 : https://computergraphics.stackexchange.com/questions/8354/why-is-glreadpixels-only-working-in-certain-cases]

 

glUseProgram — Installs a program object as part of current rendering state

[링크 : https://registry.khronos.org/OpenGL-Refpages/gl4/html/glUseProgram.xhtml]

[링크 : https://stackoverflow.com/questions/13546461/what-does-gluseprogram0-do]

'Programming > openGL' 카테고리의 다른 글

opengl glortho gluperspective  (0) 2023.08.28
openCV + openGL  (0) 2022.02.08
glMatrixMode()  (0) 2020.04.14
opengl superbible 3rd 리눅스 빌드 패키지  (0) 2020.04.08
opengl super bible 3rd - 4,5 chapter  (0) 2020.04.06
Posted by 구차니