Skip to content

Commit bef9a9d

Browse files
committed
Make sure FBO is bound before attachments are added
1 parent 205ce99 commit bef9a9d

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

demosys/opengl/fbo.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ def add_color_attachment(self, texture):
159159
self.color_buffers_ids.append(GL.GL_COLOR_ATTACHMENT0 + len(self.color_buffers))
160160
self.color_buffers.append(texture)
161161

162+
# Make sure the FBO is bound
163+
self.bind(stack=False)
164+
162165
# Attach to fbo
163166
GL.glFramebufferTexture2D(
164167
GL.GL_FRAMEBUFFER,
@@ -167,6 +170,7 @@ def add_color_attachment(self, texture):
167170
self.color_buffers[-1].texture,
168171
0
169172
)
173+
self.release(stack=False)
170174

171175
def set_depth_attachment(self, texture):
172176
"""
@@ -175,6 +179,10 @@ def set_depth_attachment(self, texture):
175179
:param texture: The Texture object
176180
"""
177181
self.depth_buffer = texture
182+
183+
# Make sure the FBO is bound
184+
self.bind(stack=False)
185+
178186
# Attach to fbo
179187
GL.glFramebufferTexture2D(
180188
GL.GL_FRAMEBUFFER,
@@ -183,6 +191,7 @@ def set_depth_attachment(self, texture):
183191
self.depth_buffer.texture,
184192
0
185193
)
194+
self.release(stack=False)
186195

187196
def check_status(self):
188197
"""

0 commit comments

Comments
 (0)