glDrawPixels optimization with textured quad

207 views Asked by At

I have a system in which I cache the back buffer of each windows in an allocated memories whenever redraw() finished its execution. The back buffer is being stored as an array of unsigned long where the content was read into as followings, and the content was being recalled using glDrawPixels();

{
    unsigned long *buffer;

    buffer = ( unsigned long * )malloc( imgW * imgH );
    redraw();
    glFinish(); 
    glReadPixels( 0, 0, imgW, imgH, GL_RGBA, GL_UNSIGNED_BYTE, buffer );

}

I had wished to optimize this process. It is to my understanding that by replacing glDrawPixels() with textured quad, on most system the process should be faster. My window is not always in POT however. After a brief research, there appeared to be these three approaches people use.

  1. GL_TEXTURE_RECTANGLE_ARB/(GL_TEXTURE_RECTANGLE?)
  2. Make the canvas size of your image into a POT image whereas the extended sections are to be padded by other colors.
  3. Break your image into smaller tiles of POT attributes, then re-construct them later accordingly.

My questions are these.

  1. Which is the approach most would implement? For the moment, I am incline toward the first. Though, I gathered that it is not too friendly toward old graphic cards?
  2. What are the differences between GL_TEXTURE_RECTANGLE and GL_TEXTURE_RECTANGLE_ARB?
  3. Would this effected the multisampling capabilities I do have in the buffer I read from? I gather that multisamplings are calculated during all the drawing functions so this should be like simply copying the resulting pixels?
  4. If I want to output what was being cached as an image for a debugging purpose, how should the method be approached?
  5. Are there more ways, I can also optimize glDrawPixels() barring the use of FBO, or PBO?
0

There are 0 answers