Procházet zdrojové kódy

gl: destroy texture

Karl Zylinski před 4 měsíci
rodič
revize
389f7888fe
1 změnil soubory, kde provedl 7 přidání a 3 odebrání
  1. 7 3
      render_backend_gl.odin

+ 7 - 3
render_backend_gl.odin

@@ -374,16 +374,20 @@ gl_update_texture :: proc(th: Texture_Handle, data: []u8, rect: Rect) -> bool {
 		return false
 	}
 
-	//pf := gl_translate_pixel_format(tex.format)
-
-
     gl.BindTexture(gl.TEXTURE_2D, tex.id)
 	gl.TexSubImage2D(gl.TEXTURE_2D, 0, i32(rect.x), i32(rect.y), i32(rect.w), i32(rect.h), gl.RGBA, gl.UNSIGNED_BYTE, raw_data(data))
 	return true
 }
 
 gl_destroy_texture :: proc(th: Texture_Handle) {
+	tex := hm.get(&s.textures, th)
+
+	if tex == nil {
+		return
+	}
 
+	gl.DeleteTextures(1, &tex.id)
+	hm.remove(&s.textures, th)
 }
 
 Shader_Compile_Result_OK :: struct {}