aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorraysan5 <raysan5@gmail.com>2016-06-03 18:08:50 +0200
committerraysan5 <raysan5@gmail.com>2016-06-03 18:08:50 +0200
commitb574e105dd8790bdc60ffb4876f840ff3316abe4 (patch)
treecf224feed0b6ca784cd5d4d9028f76c93988192b /examples
parent4dfffff19b003172c214a9b185ee29b990fd5b70 (diff)
downloadraylib-b574e105dd8790bdc60ffb4876f840ff3316abe4.tar.gz
raylib-b574e105dd8790bdc60ffb4876f840ff3316abe4.zip
Basic raylib Oculus Rift template for reference
Not functional yet...
Diffstat (limited to 'examples')
-rw-r--r--examples/core_oculus_rift.c72
1 files changed, 72 insertions, 0 deletions
diff --git a/examples/core_oculus_rift.c b/examples/core_oculus_rift.c
new file mode 100644
index 00000000..faf15d7f
--- /dev/null
+++ b/examples/core_oculus_rift.c
@@ -0,0 +1,72 @@
+/*******************************************************************************************
+*
+* raylib [core] example - Oculus Rift CV1
+*
+* This example has been created using raylib 1.5 (www.raylib.com)
+* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
+*
+* Copyright (c) 2016 Ramon Santamaria (@raysan5)
+*
+********************************************************************************************/
+
+#include "raylib.h"
+
+int main()
+{
+ // Initialization
+ //--------------------------------------------------------------------------------------
+ int screenWidth = 1080;
+ int screenHeight = 600;
+
+ InitWindow(screenWidth, screenHeight, "raylib [core] example - oculus rift");
+
+ InitOculusDevice();
+
+ // Define the camera to look into our 3d world
+ Camera camera;
+ camera.position = (Vector3){ 5.0f, 5.0f, 5.0f }; // Camera position
+ camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
+ camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
+ camera.fovy = 45.0f; // Camera field-of-view Y
+
+ Vector3 cubePosition = { 0.0f, 0.0f, 0.0f };
+
+ SetTargetFPS(90); // Set our game to run at 90 frames-per-second
+ //--------------------------------------------------------------------------------------
+
+ // Main game loop
+ while (!WindowShouldClose()) // Detect window close button or ESC key
+ {
+ // Update
+ //----------------------------------------------------------------------------------
+ UpdateOculusTracking();
+ //----------------------------------------------------------------------------------
+
+ // Draw
+ //----------------------------------------------------------------------------------
+ BeginDrawing();
+
+ ClearBackground(RAYWHITE);
+
+ Begin3dMode(camera);
+
+ DrawCube(cubePosition, 2.0f, 2.0f, 2.0f, RED);
+ DrawCubeWires(cubePosition, 2.0f, 2.0f, 2.0f, MAROON);
+
+ DrawGrid(10, 1.0f);
+
+ End3dMode();
+
+ EndDrawing();
+ //----------------------------------------------------------------------------------
+ }
+
+ // De-Initialization
+ //--------------------------------------------------------------------------------------
+ CloseOculusdevice(); // Close Oculus Rift device
+
+ CloseWindow(); // Close window and OpenGL context
+ //--------------------------------------------------------------------------------------
+
+ return 0;
+}