mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-01-17 22:55:38 +00:00
Work-around for no front buffer access on GLES.
Buffer swap now occurs after update but before render.
This commit is contained in:
parent
56569e5425
commit
5619674c55
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue