diff --git a/src/components/ImageComponent.cpp b/src/components/ImageComponent.cpp index 040348cff..238c9019e 100644 --- a/src/components/ImageComponent.cpp +++ b/src/components/ImageComponent.cpp @@ -359,13 +359,20 @@ void ImageComponent::copyScreen() { unloadImage(); - glReadBuffer(GL_FRONT); + int width = Renderer::getScreenWidth(); + int height = Renderer::getScreenHeight(); + + //glReadBuffer(GL_FRONT); + + /*char* data = new char[width*height*3]; + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE, data);*/ glGenTextures(1, &mTextureID); glBindTexture(GL_TEXTURE_2D, mTextureID); - int width = Renderer::getScreenWidth(); - int height = Renderer::getScreenHeight(); + //glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data); + //delete[] data; glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 0, 0, width, height, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); diff --git a/src/main.cpp b/src/main.cpp index d633b960b..64367bb05 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -190,6 +190,7 @@ int main(int argc, char* argv[]) lastTime = curTime; window.update(deltaTime); + Renderer::swapBuffers(); //swap here so we can read the last screen state during updates (see ImageComponent::copyScreen()) window.render(); if(Settings::getInstance()->getBool("DRAWFRAMERATE")) @@ -221,9 +222,10 @@ int main(int argc, char* argv[]) sleeping = true; timeSinceLastEvent = 0; Renderer::drawRect(0, 0, Renderer::getScreenWidth(), Renderer::getScreenHeight(), 0x000000A0); + Renderer::swapBuffers(); } - Renderer::swapBuffers(); + Log::flush(); }