summaryrefslogtreecommitdiffhomepage
path: root/src/rlgl.c
diff options
context:
space:
mode:
authorvictorfisac <[email protected]>2016-11-21 20:27:43 +0100
committervictorfisac <[email protected]>2016-11-21 20:27:43 +0100
commit0716125ee93db7539a27e831eba3c856f55601ab (patch)
treeb4ee417efa904f26b6b08bd25d66538ebe267283 /src/rlgl.c
parent80f6b2f9635d8e4707b528337c39c0ba7bf9cf5f (diff)
parent918fc002d0e75f5ea15036634edf8aa3fba9bedc (diff)
downloadraylib-0716125ee93db7539a27e831eba3c856f55601ab.tar.gz
raylib-0716125ee93db7539a27e831eba3c856f55601ab.zip
Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop
Diffstat (limited to 'src/rlgl.c')
-rw-r--r--src/rlgl.c35
1 files changed, 27 insertions, 8 deletions
diff --git a/src/rlgl.c b/src/rlgl.c
index e2804e9c..b567f8fd 100644
--- a/src/rlgl.c
+++ b/src/rlgl.c
@@ -2,11 +2,30 @@
*
* rlgl - raylib OpenGL abstraction layer
*
-* raylib now uses OpenGL 1.1 style functions (rlVertex) that are mapped to selected OpenGL version:
-* OpenGL 1.1 - Direct map rl* -> gl*
-* OpenGL 2.1 - Vertex data is stored in VBOs, call rlglDraw() to render
-* OpenGL 3.3 - Vertex data is stored in VAOs, call rlglDraw() to render
-* OpenGL ES 2 - Vertex data is stored in VBOs or VAOs (when available), call rlglDraw() to render
+* rlgl allows usage of OpenGL 1.1 style functions (rlVertex) that are internally mapped to
+* selected OpenGL version (1.1, 2.1, 3.3 Core, ES 2.0).
+*
+* When chosing an OpenGL version greater than OpenGL 1.1, rlgl stores vertex data on internal
+* VBO buffers (and VAOs if available). It requires calling 3 functions:
+* rlglInit() - Initialize internal buffers and auxiliar resources
+* rlglDraw() - Process internal buffers and send required draw calls
+* rlglClose() - De-initialize internal buffers data and other auxiliar resources
+*
+* External libs:
+* raymath - 3D math functionality (Vector3, Matrix, Quaternion)
+* GLAD - OpenGL extensions loading (OpenGL 3.3 Core only)
+*
+* Module Configuration Flags:
+* GRAPHICS_API_OPENGL_11 - Use OpenGL 1.1 backend
+* GRAPHICS_API_OPENGL_21 - Use OpenGL 2.1 backend
+* GRAPHICS_API_OPENGL_33 - Use OpenGL 3.3 Core profile backend
+* GRAPHICS_API_OPENGL_ES2 - Use OpenGL ES 2.0 backend
+*
+* RLGL_STANDALONE - Use rlgl as standalone library (no raylib dependency)
+* RLGL_NO_STANDARD_SHADER - Avoid standard shader (shader_standard.h) inclusion
+* RLGL_NO_DISTORTION_SHADER - Avoid stereo rendering distortion sahder (shader_distortion.h) inclusion
+* RLGL_OCULUS_SUPPORT - Enable Oculus Rift CV1 functionality
+*
*
* Copyright (c) 2014-2016 Ramon Santamaria (@raysan5)
*
@@ -2767,13 +2786,13 @@ void CloseVrDevice(void)
// Detect if VR device is available
bool IsVrDeviceReady(void)
{
- return (vrDeviceReady || vrSimulator) && vrEnabled;
+ return (vrDeviceReady && vrEnabled);
}
// Detect if VR simulator is running
bool IsVrSimulator(void)
{
- return vrSimulator;
+ return (vrSimulator && vrEnabled);
}
// Enable/Disable VR experience (device or simulator)
@@ -3882,7 +3901,7 @@ static void SetStereoConfig(VrDeviceInfo hmd)
// Fovy is normally computed with: 2*atan2(hmd.vScreenSize, 2*hmd.eyeToScreenDistance)*RAD2DEG
// ...but with lens distortion it is increased (see Oculus SDK Documentation)
//float fovy = 2.0f*atan2(hmd.vScreenSize*0.5f*distortionScale, hmd.eyeToScreenDistance)*RAD2DEG; // Really need distortionScale?
- float fovy = 2.0f*atan2(hmd.vScreenSize*0.5f, hmd.eyeToScreenDistance)*RAD2DEG;
+ float fovy = 2.0f*(float)atan2(hmd.vScreenSize*0.5f, hmd.eyeToScreenDistance)*RAD2DEG;
// Compute camera projection matrices
float projOffset = 4.0f*lensShift; // Scaled to projection space coordinates [-1..1]