Skip to content

Commit 9a83880

Browse files
committed
Remove unnecessary gl.UNPACK_FLIP_Y_WEBGL setting
1 parent 3082675 commit 9a83880

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

p5.Framebuffer.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ class Framebuffer {
127127
const density = this._renderer._pInst._pixelDensity
128128
const hasAlpha = this._renderer._pInst._glAttributes.alpha
129129

130+
const prevBoundTexture = gl.getParameter(gl.TEXTURE_BINDING_2D)
131+
const prevBoundFramebuffer = gl.getParameter(gl.FRAMEBUFFER_BINDING)
132+
130133
const colorTexture = gl.createTexture()
131134
if (!colorTexture) {
132135
throw new Error('Unable to create color texture')
@@ -136,7 +139,6 @@ class Framebuffer {
136139
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST)
137140
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE)
138141
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE)
139-
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true)
140142
gl.texImage2D(
141143
gl.TEXTURE_2D,
142144
0,
@@ -159,7 +161,6 @@ class Framebuffer {
159161
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST)
160162
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE)
161163
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE)
162-
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true)
163164
gl.texImage2D(
164165
gl.TEXTURE_2D,
165166
0,
@@ -204,8 +205,8 @@ class Framebuffer {
204205
)
205206
this._renderer.textures.push(colorP5Texture)
206207

207-
gl.bindTexture(gl.TEXTURE_2D, null)
208-
gl.bindFramebuffer(gl.FRAMEBUFFER, null)
208+
gl.bindTexture(gl.TEXTURE_2D, prevBoundTexture)
209+
gl.bindFramebuffer(gl.FRAMEBUFFER, prevBoundFramebuffer)
209210

210211
this.depthTexture = depthTexture
211212
this.depth = depthP5Texture

0 commit comments

Comments
 (0)