Programming/openGL
glReadPixels() 와 glUseProgram()
구차니
2022. 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. |
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]