Browse Source

Unload model shaders and textures

They are not automatically unloaded when unloading the model!
pull/955/head
raysan5 5 years ago
parent
commit
37a6f12037
6 changed files with 13 additions and 3 deletions
  1. +2
    -0
      examples/models/models_animation.c
  2. +3
    -1
      examples/models/models_material_pbr.c
  3. +2
    -1
      examples/models/models_mesh_generation.c
  4. +1
    -0
      examples/models/models_obj_viewer.c
  5. +4
    -1
      examples/models/models_skybox.c
  6. +1
    -0
      examples/models/models_yaw_pitch_roll.c

+ 2
- 0
examples/models/models_animation.c View File

@ -98,6 +98,8 @@ int main(void)
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadTexture(texture); // Unload texture
// Unload model animations data
for (int i = 0; i < animsCount; i++) UnloadModelAnimation(anims[i]);
RL_FREE(anims);

+ 3
- 1
examples/models/models_material_pbr.c View File

@ -100,7 +100,9 @@ int main(void)
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadModel(model); // Unload skybox model
// TODO: Unload materials and shaders
UnloadModel(model); // Unload model
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------

+ 2
- 1
examples/models/models_mesh_generation.c View File

@ -115,11 +115,12 @@ int main(void)
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadTexture(texture); // Unload texture
// Unload models data (GPU VRAM)
for (int i = 0; i < NUM_MODELS; i++) UnloadModel(models[i]);
CloseWindow(); // Close window and OpenGL context
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;

+ 1
- 0
examples/models/models_obj_viewer.c View File

@ -116,6 +116,7 @@ int main(void)
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadTexture(texture); // Unload texture
UnloadModel(model); // Unload model
ClearDroppedFiles(); // Clear internal buffers

+ 4
- 1
examples/models/models_skybox.c View File

@ -89,7 +89,10 @@ int main(void)
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadModel(skybox); // Unload skybox model (and textures)
UnloadShader(skybox.materials[0].shader);
UnloadTexture(skybox.materials[0].maps[MAP_CUBEMAP].texture);
UnloadModel(skybox); // Unload skybox model
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------

+ 1
- 0
examples/models/models_yaw_pitch_roll.c View File

@ -169,6 +169,7 @@ int main(void)
//--------------------------------------------------------------------------------------
// Unload all loaded data
UnloadTexture(model.materials[0].maps[MAP_DIFFUSE].texture);
UnloadModel(model);
UnloadRenderTexture(framebuffer);

Loading…
Cancel
Save