I am new to OpenGL. I would like to draw a man’s silhouette in OpenGL and process it into OpenCV. I managed to draw some basic forms with glut. Then, I use
glReadPixels(0,0, 640, 480, GL_RGB, GL_UNSIGNED_BYTE, (unsigned int*) cvImage->imageData);
It sends the pixels to the cvImage buffer, and I can display the image in OpenCV. So basically it works, but it’s veeeeeeeeeeeeeeeery slow. If I compare the program with and without this line, it’s like 100 times slower. And I need to do it a lot.
Is there a way to do it faster ? It’s just one loop through the image, it should be super fast !
And better, I don’t need glut’s window and mainloop. So if I could just know how to access the image buffer from OpenGL, it would be great !
Who is doing the conversion 3D, 2D ? glut or OpenGL ? And When ?
Sorry to bother you with all these questions, but I really don’t know where to start looking.