Updated examples for next raylib version
This commit is contained in:
parent
a98578c91d
commit
067b884f39
6 changed files with 16 additions and 17 deletions
|
@ -23,13 +23,13 @@ int main()
|
|||
// Define the camera to look into our 3d world
|
||||
Camera camera = {{ 7.0, 7.0, 7.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
|
||||
|
||||
Image img = LoadImage("resources/cubicmap.png"); // Load cubesmap image (RAM)
|
||||
Texture2D texture = LoadTextureFromImage(img, false); // Convert image to texture (VRAM)
|
||||
Model map = LoadCubicmap(img); // Load cubicmap model
|
||||
Image image = LoadImage("resources/cubicmap.png"); // Load cubesmap image (RAM)
|
||||
Texture2D texture = LoadTextureFromImage(image); // Convert image to texture (VRAM)
|
||||
Model map = LoadCubicmap(image); // Load cubicmap model (generate model from image)
|
||||
SetModelTexture(&map, texture); // Bind texture to model
|
||||
Vector3 mapPosition = { -1, 0.0, -1 }; // Set model position
|
||||
|
||||
UnloadImage(img); // Unload cubesmap image from RAM, already uploaded to VRAM
|
||||
UnloadImage(image); // Unload cubesmap image from RAM, already uploaded to VRAM
|
||||
|
||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
|
|
@ -23,13 +23,13 @@ int main()
|
|||
// Define the camera to look into our 3d world
|
||||
Camera camera = {{ 10.0, 12.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
|
||||
|
||||
Image img = LoadImage("resources/heightmap.png"); // Load heightmap image (RAM)
|
||||
Texture2D texture = LoadTextureFromImage(img, false); // Convert image to texture (VRAM)
|
||||
Model map = LoadHeightmap(img, 4); // Load heightmap model
|
||||
Image image = LoadImage("resources/heightmap.png"); // Load heightmap image (RAM)
|
||||
Texture2D texture = LoadTextureFromImage(image); // Convert image to texture (VRAM)
|
||||
Model map = LoadHeightmap(image, 4); // Load heightmap model
|
||||
SetModelTexture(&map, texture); // Bind texture to model
|
||||
Vector3 mapPosition = { -4, 0.0, -4 }; // Set model position
|
||||
|
||||
UnloadImage(img); // Unload heightmap image from RAM, already uploaded to VRAM
|
||||
UnloadImage(image); // Unload heightmap image from RAM, already uploaded to VRAM
|
||||
|
||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
|
|
@ -42,8 +42,7 @@ int main()
|
|||
|
||||
Begin3dMode(camera);
|
||||
|
||||
DrawPlane((Vector3){ 0, 0, 0 }, (Vector2){ 4, 4 }, (Vector3){ 0, 45, 0 }, RED);
|
||||
//DrawPlaneEx((Vector3){ 0, 8, 0 }, (Vector2){ 2, 1 }, (Vector3){ 0, 0, 0 }, 4, 4, SKYBLUE);
|
||||
DrawPlane((Vector3){ 0, 0, 0 }, (Vector2){ 4, 4 }, RED); // Draw a plane XZ
|
||||
|
||||
DrawGrid(10.0, 1.0);
|
||||
|
||||
|
|
|
@ -24,8 +24,8 @@ int main()
|
|||
InitWindow(screenWidth, screenHeight, "raylib [textures] example - DDS texture loading and drawing");
|
||||
|
||||
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
|
||||
//Texture2D texture = LoadTexture("resources/raylib_logo.dds"); // Texture loading (compressed)
|
||||
Texture2D texture = LoadTexture("resources/raylib_logo_uncompressed.dds"); // Texture loading (uncompressed)
|
||||
|
||||
Texture2D texture = LoadTexture("resources/raylib_logo.dds"); // Texture loading (compressed)
|
||||
|
||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
|
|
@ -24,10 +24,10 @@ int main()
|
|||
|
||||
// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
|
||||
|
||||
Image img = LoadImage("resources/raylib_logo.png"); // Loaded in CPU memory (RAM)
|
||||
Texture2D texture = LoadTextureFromImage(img, false); // Image converted to texture, GPU memory (VRAM)
|
||||
Image image = LoadImage("resources/raylib_logo.png"); // Loaded in CPU memory (RAM)
|
||||
Texture2D texture = LoadTextureFromImage(image); // Image converted to texture, GPU memory (VRAM)
|
||||
|
||||
UnloadImage(img); // Once image has been converted to texture and uploaded to VRAM, it can be unloaded from RAM
|
||||
UnloadImage(image); // Once image has been converted to texture and uploaded to VRAM, it can be unloaded from RAM
|
||||
//---------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
|
|
|
@ -24,10 +24,10 @@ int main()
|
|||
InitWindow(screenWidth, screenHeight, "raylib [textures] example - texture mipmaps generation");
|
||||
|
||||
// NOTE: To generate mipmaps for an image, image must be loaded first and converted to texture
|
||||
// with mipmaps option set to true on CreateTexture()
|
||||
|
||||
Image image = LoadImage("resources/raylib_logo.png"); // Load image to CPU memory (RAM)
|
||||
Texture2D texture = LoadTextureFromImage(image, true); // Create texture and generate mipmaps
|
||||
Texture2D texture = LoadTextureFromImage(image); // Load texture into GPU memory (VRAM)
|
||||
GenTextureMipmaps(texture); // Generate mipmaps for texture
|
||||
|
||||
UnloadImage(image); // Once texture has been created, we can unload image data from RAM
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue