Some example tweaks
This commit is contained in:
parent
6f7b721d81
commit
2edec8ae28
2 changed files with 16 additions and 4 deletions
|
@ -18,6 +18,12 @@
|
||||||
|
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#if defined(PLATFORM_DESKTOP)
|
||||||
|
#define GLSL_VERSION 330
|
||||||
|
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
||||||
|
#define GLSL_VERSION 100
|
||||||
|
#endif
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
// Initialization
|
// Initialization
|
||||||
|
@ -37,7 +43,7 @@ int main()
|
||||||
|
|
||||||
// Load raymarching shader
|
// Load raymarching shader
|
||||||
// NOTE: Defining 0 (NULL) for vertex shader forces usage of internal default vertex shader
|
// NOTE: Defining 0 (NULL) for vertex shader forces usage of internal default vertex shader
|
||||||
Shader shader = LoadShader(0, "resources/shaders/glsl330/raymarching.fs");
|
Shader shader = LoadShader(0, FormatText("resources/shaders/glsl%i/raymarching.fs", GLSL_VERSION));
|
||||||
|
|
||||||
// Get shader locations for required uniforms
|
// Get shader locations for required uniforms
|
||||||
int viewEyeLoc = GetShaderLocation(shader, "viewEye");
|
int viewEyeLoc = GetShaderLocation(shader, "viewEye");
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*******************************************************************************************
|
/*******************************************************************************************
|
||||||
*
|
*
|
||||||
* raylib [textures] example - Shader texture drawing
|
* raylib [textures] example - Texture drawing
|
||||||
*
|
*
|
||||||
* This example illustrates how to draw on a blank texture using a shader
|
* This example illustrates how to draw on a blank texture using a shader
|
||||||
*
|
*
|
||||||
|
@ -13,6 +13,12 @@
|
||||||
|
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
|
|
||||||
|
#if defined(PLATFORM_DESKTOP)
|
||||||
|
#define GLSL_VERSION 330
|
||||||
|
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
|
||||||
|
#define GLSL_VERSION 100
|
||||||
|
#endif
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
// Initialization
|
// Initialization
|
||||||
|
@ -20,14 +26,14 @@ int main()
|
||||||
int screenWidth = 800;
|
int screenWidth = 800;
|
||||||
int screenHeight = 450;
|
int screenHeight = 450;
|
||||||
|
|
||||||
InitWindow(screenWidth, screenHeight, "raylib [shaders] example - shader texture drawing");
|
InitWindow(screenWidth, screenHeight, "raylib [shaders] example - texture drawing");
|
||||||
|
|
||||||
Image imBlank = GenImageColor(1024, 1024, BLANK);
|
Image imBlank = GenImageColor(1024, 1024, BLANK);
|
||||||
Texture2D texture = LoadTextureFromImage(imBlank); // Load blank texture to fill on shader
|
Texture2D texture = LoadTextureFromImage(imBlank); // Load blank texture to fill on shader
|
||||||
UnloadImage(imBlank);
|
UnloadImage(imBlank);
|
||||||
|
|
||||||
// NOTE: Using GLSL 330 shader version, on OpenGL ES 2.0 use GLSL 100 shader version
|
// NOTE: Using GLSL 330 shader version, on OpenGL ES 2.0 use GLSL 100 shader version
|
||||||
Shader shader = LoadShader(0, "resources/shaders/glsl330/cubes_panning.fs");
|
Shader shader = LoadShader(0, FormatText("resources/shaders/glsl%i/cubes_panning.fs", GLSL_VERSION));
|
||||||
|
|
||||||
float time = 0.0f;
|
float time = 0.0f;
|
||||||
int timeLoc = GetShaderLocation(shader, "uTime");
|
int timeLoc = GetShaderLocation(shader, "uTime");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue