summaryrefslogtreecommitdiffhomepage
path: root/examples/web/shaders/shaders_texture_drawing.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/web/shaders/shaders_texture_drawing.c')
-rw-r--r--examples/web/shaders/shaders_texture_drawing.c114
1 files changed, 0 insertions, 114 deletions
diff --git a/examples/web/shaders/shaders_texture_drawing.c b/examples/web/shaders/shaders_texture_drawing.c
deleted file mode 100644
index 374bc2b..0000000
--- a/examples/web/shaders/shaders_texture_drawing.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/*******************************************************************************************
-*
-* raylib [textures] example - Texture drawing
-*
-* This example illustrates how to draw on a blank texture using a shader
-*
-* This example has been created using raylib 2.0 (www.raylib.com)
-* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
-*
-* Example contributed by Michał Ciesielski and reviewed by Ramon Santamaria (@raysan5)
-*
-* Copyright (c) 2019 Michał Ciesielski and Ramon Santamaria (@raysan5)
-*
-********************************************************************************************/
-
-#include "raylib.h"
-
-#if defined(PLATFORM_WEB)
- #include <emscripten/emscripten.h>
-#endif
-
-#if defined(PLATFORM_DESKTOP)
- #define GLSL_VERSION 330
-#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
- #define GLSL_VERSION 100
-#endif
-
-//----------------------------------------------------------------------------------
-// Global Variables Definition
-//----------------------------------------------------------------------------------
-const int screenWidth = 800;
-const int screenHeight = 450;
-
-// NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required)
-
-Texture2D texture = { 0 };
-Shader shader = { 0 };
-
-static float time = 0.0f; // WARNING: This variable MUST be static, it seems to collide somewhere
-int timeLoc = 0;
-
-//----------------------------------------------------------------------------------
-// Module Functions Declaration
-//----------------------------------------------------------------------------------
-void UpdateDrawFrame(void); // Update and Draw one frame
-
-//----------------------------------------------------------------------------------
-// Program Main Entry Point
-//----------------------------------------------------------------------------------
-int main(void)
-{
- // Initialization
- //--------------------------------------------------------------------------------------
- InitWindow(screenWidth, screenHeight, "raylib [shaders] example - texture drawing");
-
- Image imBlank = GenImageColor(1024, 1024, BLANK);
- texture = LoadTextureFromImage(imBlank); // Load blank texture to fill on shader
- UnloadImage(imBlank);
-
- // NOTE: Using GLSL 330 shader version, on OpenGL ES 2.0 use GLSL 100 shader version
- shader = LoadShader(0, TextFormat("resources/shaders/glsl%i/cubes_panning.fs", GLSL_VERSION));
-
- timeLoc = GetShaderLocation(shader, "uTime");
- SetShaderValue(shader, timeLoc, &time, SHADER_UNIFORM_FLOAT);
-
-#if defined(PLATFORM_WEB)
- emscripten_set_main_loop(UpdateDrawFrame, 60, 1);
-#else
- SetTargetFPS(60); // Set our game to run at 60 frames-per-second
- //--------------------------------------------------------------------------------------
-
- // Main game loop
- while (!WindowShouldClose()) // Detect window close button or ESC key
- {
- UpdateDrawFrame();
- }
-#endif
-
- // De-Initialization
- //--------------------------------------------------------------------------------------
- UnloadShader(shader);
-
- CloseWindow(); // Close window and OpenGL context
- //--------------------------------------------------------------------------------------
-
- return 0;
-}
-
-//----------------------------------------------------------------------------------
-// Module Functions Definition
-//----------------------------------------------------------------------------------
-void UpdateDrawFrame(void)
-{
- // Update
- //----------------------------------------------------------------------------------
- time = GetTime();
- SetShaderValue(shader, timeLoc, &time, SHADER_UNIFORM_FLOAT);
- //----------------------------------------------------------------------------------
-
- // Draw
- //----------------------------------------------------------------------------------
- BeginDrawing();
-
- ClearBackground(RAYWHITE);
-
- BeginShaderMode(shader); // Enable our custom shader for next shapes/textures drawings
- DrawTexture(texture, 0, 0, WHITE); // Drawing BLANK texture, all magic happens on shader
- EndShaderMode(); // Disable our custom shader, return to default shader
-
- DrawText("BACKGROUND is PAINTED and ANIMATED on SHADER!", 10, 10, 20, MAROON);
-
- EndDrawing();
- //----------------------------------------------------------------------------------
-}