aboutsummaryrefslogtreecommitdiff
path: root/src/rlgl.c
diff options
context:
space:
mode:
authorraysan5 <raysan5@gmail.com>2016-03-20 14:20:42 +0100
committerraysan5 <raysan5@gmail.com>2016-03-20 14:20:42 +0100
commitebc2b9a286b07f551689f13fc82367c93e7c3ade (patch)
tree18c5aab68feed78dba2710da09eda833f8349f22 /src/rlgl.c
parent5e45c3c824b61abd94525c1dcd08abc5a10dc613 (diff)
downloadraylib-ebc2b9a286b07f551689f13fc82367c93e7c3ade.tar.gz
raylib-ebc2b9a286b07f551689f13fc82367c93e7c3ade.zip
Improved windows resizing system...
...despite not being enabled on GLFW3
Diffstat (limited to 'src/rlgl.c')
-rw-r--r--src/rlgl.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/rlgl.c b/src/rlgl.c
index b6a179d6..fc14a0af 100644
--- a/src/rlgl.c
+++ b/src/rlgl.c
@@ -188,6 +188,8 @@ typedef struct {
// Framebuffer Object type
typedef struct {
GLuint id;
+ int width;
+ int height;
GLuint colorTextureId;
GLuint depthTextureId;
} FBO;
@@ -1071,8 +1073,8 @@ void rlglInitPostpro(void)
quad.vertexCount = 6;
- float w = (float)screenWidth;
- float h = (float)screenHeight;
+ float w = (float)postproFbo.width;
+ float h = (float)postproFbo.height;
float quadPositions[6*3] = { w, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, h, 0.0f, 0.0f, h, 0.0f, w, h, 0.0f, w, 0.0f, 0.0f };
float quadTexcoords[6*2] = { 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f };
@@ -1096,6 +1098,8 @@ FBO rlglLoadFBO(int width, int height)
{
FBO fbo;
fbo.id = 0;
+ fbo.width = width;
+ fbo.height = height;
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
// Create the texture that will serve as the color attachment for the framebuffer
@@ -2339,22 +2343,21 @@ void SetCustomShader(Shader shader)
}
// Set postprocessing shader
-// NOTE: Uses global variables screenWidth and screenHeight
void SetPostproShader(Shader shader)
{
#if defined(GRAPHICS_API_OPENGL_33) || defined(GRAPHICS_API_OPENGL_ES2)
if (!enabledPostpro)
{
enabledPostpro = true;
- rlglInitPostpro();
+ rlglInitPostpro(); // Lazy initialization on postprocessing usage
}
SetModelShader(&postproQuad, shader);
Texture2D texture;
texture.id = postproFbo.colorTextureId;
- texture.width = screenWidth;
- texture.height = screenHeight;
+ texture.width = postproFbo.width;
+ texture.height = postproFbo.height;
postproQuad.material.texDiffuse = texture;