Hi, in my code, I have:
//get the framebuffer
glReadPixels(0,0,800,800, GL_RGBA ,GL_FLOAT ,tmpBuffer);
I got the stack overflow problem…
What’s wrong with my code?
hey powervr, try allocating the buffer memory on the heap, or move the array outside the function. under msvc, for example, the default stack size is 1 meg. 800x800x4 = 2.5 megs, just a hair too high
Bingo! I have solved the problem by moving the array outside the function()
another problem, here is my code:
glReadPixels(0, 0, 200, 200, GL_RGBA, GL_BITMAP, tmpBuffer);
Why the tmpBuffer return no value?
If I replace GL_BITMAP with GL_UNSIGNED_BYTE
, it is okay.
GL_BITMAP is not a valid type unless you’re in indexed color mode.
So if i am now in RGBA , double buffer mode,
what should i do in order to get the buffer as?
(i don’t care the values in RGB format, i just care if any pixel is draw on the screen.)
Then I suggest you use the stencil buffer to mark pixels as drawn, and read it back. If you need a bitmask of all pixels, then I’m afraid you have to build the mask yourself from the individual pixels.