Skip to content

Commit f8e9707

Browse files
committed
fix deleting a texture while it's bound
1 parent 9a3b305 commit f8e9707

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Platform/src/foster_renderer_opengl.c

+9
Original file line numberDiff line numberDiff line change
@@ -1179,6 +1179,14 @@ void FosterTextureDestroy_OpenGL(FosterTexture* texture)
11791179

11801180
if (!tex->disposed)
11811181
{
1182+
// make sure this isn't bound anymore
1183+
for (int i = 0; i < FOSTER_MAX_UNIFORM_TEXTURES; i ++)
1184+
{
1185+
fgl.stateTextureSlots[i] == tex->id;
1186+
FosterBindTexture(i, 0);
1187+
}
1188+
1189+
// delete it
11821190
tex->disposed = 1;
11831191
fgl.glDeleteTextures(1, &tex->id);
11841192
FosterTextureReturnReference(tex);
@@ -1198,6 +1206,7 @@ FosterTarget* FosterTargetCreate_OpenGL(int width, int height, FosterTextureForm
11981206

11991207
fgl.glGenFramebuffers(1, &result.id);
12001208
fgl.glBindFramebuffer(GL_FRAMEBUFFER, result.id);
1209+
fgl.stateFrameBuffer = result.id;
12011210

12021211
for (int i = 0; i < attachmentCount; i++)
12031212
{

0 commit comments

Comments
 (0)