From 71b86bf4d06d3d0c74ebb1b898da36414815d2b1 Mon Sep 17 00:00:00 2001 From: Ray Date: Tue, 6 Apr 2021 22:49:41 +0200 Subject: REDESIGNED: Vr stereo rendering --- examples/core/core_vr_simulator.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'examples') 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 //-------------------------------------------------------------------------------------- -- cgit v1.2.3