summaryrefslogtreecommitdiffhomepage
path: root/examples/models/models_skybox.c
diff options
context:
space:
mode:
authorRay <[email protected]>2018-06-21 16:48:20 +0200
committerRay <[email protected]>2018-06-21 16:48:20 +0200
commit1ff8947864f1954244feb315f930f31026bb0581 (patch)
treef994dc0dd2fb090213d052d9d9fcf3ae5cda2866 /examples/models/models_skybox.c
parentc3b948b1b270b44cdbfc035e97c31a96c963a5bd (diff)
downloadraylib-1ff8947864f1954244feb315f930f31026bb0581.tar.gz
raylib-1ff8947864f1954244feb315f930f31026bb0581.zip
Reviewed skybox example
Diffstat (limited to 'examples/models/models_skybox.c')
-rw-r--r--examples/models/models_skybox.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/examples/models/models_skybox.c b/examples/models/models_skybox.c
index bc2617ae..6f6002b8 100644
--- a/examples/models/models_skybox.c
+++ b/examples/models/models_skybox.c
@@ -36,10 +36,15 @@ int main()
Shader shdrCubemap = LoadShader("resources/shaders/cubemap.vs", "resources/shaders/cubemap.fs");
SetShaderValuei(shdrCubemap, GetShaderLocation(shdrCubemap, "equirectangularMap"), (int[1]){ 0 }, 1);
+ // Load HDR panorama (sphere) texture
Texture2D texHDR = LoadTexture("resources/dresden_square.hdr");
+
+ // Generate cubemap (texture with 6 quads-cube-mapping) from panorama HDR texture
+ // NOTE: New texture is generated rendering to texture, shader computes the sphre->cube coordinates mapping
skybox.material.maps[MAP_CUBEMAP].texture = GenTextureCubemap(shdrCubemap, texHDR, 512);
- UnloadShader(shdrCubemap); // Cubemap generation shader not required any more
+ UnloadTexture(texHDR); // Texture not required anymore, cubemap already generated
+ UnloadShader(shdrCubemap); // Unload cubemap generation shader, not required anymore
SetCameraMode(camera, CAMERA_FIRST_PERSON); // Set a first person camera mode
@@ -76,7 +81,7 @@ int main()
// De-Initialization
//--------------------------------------------------------------------------------------
- UnloadModel(skybox); // Unload skybox model
+ UnloadModel(skybox); // Unload skybox model (and textures)
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------