Commit b2a7b2ea authored by mathieu _alkama_ m's avatar mathieu _alkama_ m Committed by Gargaj
Browse files

Fix GLFW: collect real obtained framebuffer size and use it for viewport and pbos.

It forces real nWidth and nHeight and also resets settings sizes accordingly.
parent 65df8b3b
......@@ -259,6 +259,14 @@ namespace Renderer
wglSwapIntervalEXT(1);
#endif
// Now, since OpenGL is behaving a lot in fullscreen modes, lets collect the real obtained size!
int fbWidth = 1;
int fbHeight = 1;
glfwGetFramebufferSize(mWindow, &fbWidth, &fbHeight);
nWidth = settings->nWidth = fbWidth;
nHeight = settings->nHeight = fbHeight;
printf("[GLFW] Obtained framebuffer size: %d x %d\n", fbWidth, fbHeight);
static float pFullscreenQuadVertices[] =
{
-1.0, -1.0, 0.5, 0.0, 0.0,
......@@ -382,12 +390,14 @@ namespace Renderer
//create PBOs to hold the data. this allocates memory for them too
glGenBuffers(2, pbo);
glBindBuffer(GL_PIXEL_PACK_BUFFER, pbo[0]);
glBufferData(GL_PIXEL_PACK_BUFFER, settings->nWidth * settings->nHeight * sizeof(unsigned int), NULL, GL_STREAM_READ);
glBufferData(GL_PIXEL_PACK_BUFFER, nWidth * nHeight * sizeof(unsigned int), NULL, GL_STREAM_READ);
glBindBuffer(GL_PIXEL_PACK_BUFFER, pbo[1]);
glBufferData(GL_PIXEL_PACK_BUFFER, settings->nWidth * settings->nHeight * sizeof(unsigned int), NULL, GL_STREAM_READ);
glBufferData(GL_PIXEL_PACK_BUFFER, nWidth * nHeight * sizeof(unsigned int), NULL, GL_STREAM_READ);
//unbind buffers for now
glBindBuffer(GL_PIXEL_PACK_BUFFER, NULL);
glViewport(0, 0, nWidth, nHeight);
run = true;
return true;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment