//view.Render();
scr.RenderBMP(input);
scr.Present();
- sleep(5);
+ sleep(1);
scr.ScreenShot(output);
+ sleep(1);
}
inline void MainLoop(Document & doc, const Rect & bounds = Rect(0,0,1,1), const Colour & c = Colour(0.f,0.f,0.f,1.f))
int w = ViewportWidth();
int h = ViewportHeight();
- unsigned char * pixels = new unsigned char[w*h*3];
+ unsigned char * pixels = new unsigned char[w*h*4];
if (pixels == NULL)
- Fatal("Failed to allocate %d x %d x 4 = %d pixel array", w, h, w*h*3);
+ Fatal("Failed to allocate %d x %d x 4 = %d pixel array", w, h, w*h*4);
+
+
+ glReadBuffer(GL_FRONT);
+ glPixelStorei(GL_PACK_ALIGNMENT, 1);
glReadPixels(0,0,w, h, GL_BGRA, GL_UNSIGNED_BYTE, pixels);
- SDL_Surface * surf = SDL_CreateRGBSurfaceFrom(pixels, w, h, 8*3, w*3, 0,0,0,0);
+ SDL_Surface * surf = SDL_CreateRGBSurfaceFrom(pixels, w, h, 8*4, w*4, 0,0,0,0);
if (surf == NULL)
Fatal("Failed to create SDL_Surface from pixel data - %s", SDL_GetError());