Answer the question
In order to leave comments, you need to log in
opengl. How to get an RGB array of pixels from an image?
Hello.
The question on OpenGL interests.
How to get an RGB array of pixels from an image? Just three colors, no alpha.
Answer the question
In order to leave comments, you need to log in
In OpenGL the texture is loaded into video memory from RAM, it's much easier to just not remove the original texture from memory.
It makes sense to unload the framebuffer from OpenGL as a result of the work of some shader, then this is simply done by functions:
glBindFramebuffer(GL_FRAMEBUFFER_EXT, framebuffer->id);
glBindTexture(GL_TEXTURE_2D, framebuffer->image->id);
glReadBuffer(GL_COLOR_ATTACHMENT0_EXT);
GLubyte* img = (GLubyte*) malloc(framebuffer->w * framebuffer->h * sizeof(GLubyte) * 3);
glReadPixels(0, 0, framebuffer->w, framebuffer->h, GL_RGB, GL_UNSIGNED_BYTE, img);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question