gl_common: fix gl error when blur is not enabled
blur_textures are not initialized when blur is disabled, but we still try to resize them in gl_resize. Don't do that. Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
e40f16c60e
commit
e1c5e7ab8d
|
@ -462,14 +462,16 @@ void gl_resize(struct gl_data *gd, int width, int height) {
|
||||||
gd->height = height;
|
gd->height = height;
|
||||||
gd->width = width;
|
gd->width = width;
|
||||||
|
|
||||||
// Resize the temporary textures
|
if (gd->npasses > 0) {
|
||||||
glBindTexture(gd->blur_texture_target, gd->blur_texture[0]);
|
// Resize the temporary textures used for blur
|
||||||
glTexImage2D(gd->blur_texture_target, 0, GL_RGBA8, gd->width, gd->height, 0,
|
glBindTexture(gd->blur_texture_target, gd->blur_texture[0]);
|
||||||
GL_BGRA, GL_UNSIGNED_BYTE, NULL);
|
|
||||||
if (gd->npasses > 1) {
|
|
||||||
glBindTexture(gd->blur_texture_target, gd->blur_texture[1]);
|
|
||||||
glTexImage2D(gd->blur_texture_target, 0, GL_RGBA8, gd->width, gd->height,
|
glTexImage2D(gd->blur_texture_target, 0, GL_RGBA8, gd->width, gd->height,
|
||||||
0, GL_BGRA, GL_UNSIGNED_BYTE, NULL);
|
0, GL_BGRA, GL_UNSIGNED_BYTE, NULL);
|
||||||
|
if (gd->npasses > 1) {
|
||||||
|
glBindTexture(gd->blur_texture_target, gd->blur_texture[1]);
|
||||||
|
glTexImage2D(gd->blur_texture_target, 0, GL_RGBA8, gd->width,
|
||||||
|
gd->height, 0, GL_BGRA, GL_UNSIGNED_BYTE, NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -669,6 +671,7 @@ bool gl_init(struct gl_data *gd, session_t *ps) {
|
||||||
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||||
glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||||
|
|
||||||
|
gd->npasses = 0;
|
||||||
gl_win_shader_from_string(NULL, win_shader_glsl, &gd->win_shader);
|
gl_win_shader_from_string(NULL, win_shader_glsl, &gd->win_shader);
|
||||||
if (!gl_init_blur(gd, ps->o.blur_kerns)) {
|
if (!gl_init_blur(gd, ps->o.blur_kerns)) {
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue