Good stuff TinDragon! Sorry I can't help with your bmax problem.
If you change
glDrawPixels(g_w,g_h,GL_BGRA_EXT,GL_UNSIGNED_BYTE,pBuffer)to
glDrawPixels(g_w,g_h,GL_RGBA,GL_UNSIGNED_BYTE,pBuffer)it'll convert the pixels the other way round. If that's more convenient?
Jim