summaryrefslogtreecommitdiffhomepage
path: root/examples/core/core_vr_simulator.c
diff options
context:
space:
mode:
authorRay <[email protected]>2021-04-06 22:49:41 +0200
committerRay <[email protected]>2021-04-06 22:49:41 +0200
commit71b86bf4d06d3d0c74ebb1b898da36414815d2b1 (patch)
tree94fbb8e612f52d8f7440464dac78d4e1c0bf0706 /examples/core/core_vr_simulator.c
parentfd663024eadae3c0ab0e86e0f0d6ad64a95f4cac (diff)
downloadraylib-71b86bf4d06d3d0c74ebb1b898da36414815d2b1.tar.gz
raylib-71b86bf4d06d3d0c74ebb1b898da36414815d2b1.zip
REDESIGNED: Vr stereo rendering
Diffstat (limited to 'examples/core/core_vr_simulator.c')
-rw-r--r--examples/core/core_vr_simulator.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/examples/core/core_vr_simulator.c b/examples/core/core_vr_simulator.c
index b311b8c0..f0e322a1 100644
--- a/examples/core/core_vr_simulator.c
+++ b/examples/core/core_vr_simulator.c
@@ -12,9 +12,9 @@
#include "raylib.h"
#if defined(PLATFORM_DESKTOP)
- #define GLSL_VERSION 330
+ #define GLSL_VERSION 330
#else // PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB
- #define GLSL_VERSION 100
+ #define GLSL_VERSION 100
#endif
int main(void)
@@ -51,11 +51,8 @@ int main(void)
.chromaAbCorrection[3] = 0.0f, // Chromatic aberration correction parameter 3
};
- // Init VR simulator (Oculus Rift CV1 parameters)
- InitVrSimulator(device);
-
- // Get Vr stereo config parameters for device parameters
- VrStereoConfig config = GetVrConfig(device);
+ // Load VR stereo config for VR device parameteres (Oculus Rift CV1 parameters)
+ VrStereoConfig config = LoadVrStereoMode(device);
// Distortion shader (uses device lens distortion and chroma)
Shader distortion = LoadShader(0, TextFormat("resources/distortion%i.fs", GLSL_VERSION));
@@ -104,7 +101,7 @@ int main(void)
ClearBackground(RAYWHITE);
- BeginVrDrawing(target);
+ BeginVrStereoMode(target, config);
BeginMode3D(camera);
DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED);
@@ -113,7 +110,7 @@ int main(void)
DrawGrid(40, 1.0f);
EndMode3D();
- EndVrDrawing();
+ EndVrStereoMode();
BeginShaderMode(distortion);
DrawTextureRec(target.texture, (Rectangle){ 0, 0, (float)target.texture.width, (float)-target.texture.height }, (Vector2){ 0.0f, 0.0f }, WHITE);
@@ -127,11 +124,11 @@ int main(void)
// De-Initialization
//--------------------------------------------------------------------------------------
+ UnloadVrStereoConfig(config); // Unload stereo config
+
UnloadRenderTexture(target); // Unload stereo render fbo
UnloadShader(distortion); // Unload distortion shader
- CloseVrSimulator(); // Close VR simulator
-
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------