mirror of
https://github.com/raysan5/raylib.git
synced 2025-09-23 03:28:30 +00:00
Review UpdateVrTracking() and rlglLoadRenderTexture()
This commit is contained in:
@@ -892,7 +892,7 @@ RLAPI void InitVrDevice(int vdDevice); // Init VR device
|
|||||||
RLAPI void CloseVrDevice(void); // Close VR device
|
RLAPI void CloseVrDevice(void); // Close VR device
|
||||||
RLAPI bool IsVrDeviceReady(void); // Detect if VR device (or simulator) is ready
|
RLAPI bool IsVrDeviceReady(void); // Detect if VR device (or simulator) is ready
|
||||||
RLAPI bool IsVrSimulator(void); // Detect if VR simulator is running
|
RLAPI bool IsVrSimulator(void); // Detect if VR simulator is running
|
||||||
RLAPI void UpdateVrTracking(void); // Update VR tracking (position and orientation)
|
RLAPI void UpdateVrTracking(Camera *camera); // Update VR tracking (position and orientation) and camera
|
||||||
RLAPI void ToggleVrMode(void); // Enable/Disable VR experience (device or simulator)
|
RLAPI void ToggleVrMode(void); // Enable/Disable VR experience (device or simulator)
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
|
17
src/rlgl.c
17
src/rlgl.c
@@ -1522,7 +1522,7 @@ RenderTexture2D rlglLoadRenderTexture(int width, int height)
|
|||||||
target.texture.id = 0;
|
target.texture.id = 0;
|
||||||
target.texture.width = width;
|
target.texture.width = width;
|
||||||
target.texture.height = height;
|
target.texture.height = height;
|
||||||
target.texture.format = UNCOMPRESSED_R8G8B8;
|
target.texture.format = UNCOMPRESSED_R8G8B8A8;
|
||||||
target.texture.mipmaps = 1;
|
target.texture.mipmaps = 1;
|
||||||
|
|
||||||
target.depth.id = 0;
|
target.depth.id = 0;
|
||||||
@@ -1539,7 +1539,7 @@ RenderTexture2D rlglLoadRenderTexture(int width, int height)
|
|||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
|
|
||||||
#if defined(GRAPHICS_API_OPENGL_33)
|
#if defined(GRAPHICS_API_OPENGL_33)
|
||||||
@@ -2734,16 +2734,17 @@ void ToggleVrMode(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update VR tracking (position and orientation)
|
// Update VR tracking (position and orientation) and camera
|
||||||
void UpdateVrTracking(void)
|
void UpdateVrTracking(Camera *camera)
|
||||||
{
|
{
|
||||||
#if defined(RLGL_OCULUS_SUPPORT)
|
#if defined(RLGL_OCULUS_SUPPORT)
|
||||||
if (vrDeviceReady) UpdateOculusTracking();
|
if (vrDeviceReady)
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
// TODO: Use alternative inputs (mouse, keyboard) to simulate tracking data (eyes position/orientation)
|
UpdateOculusTracking();
|
||||||
|
|
||||||
|
// TODO: Update camera data (position, target, up) with tracking data
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// Begin Oculus drawing configuration
|
// Begin Oculus drawing configuration
|
||||||
|
@@ -375,7 +375,7 @@ float *MatrixToFloat(Matrix mat);
|
|||||||
void InitVrDevice(int vrDevice); // Init VR device
|
void InitVrDevice(int vrDevice); // Init VR device
|
||||||
void CloseVrDevice(void); // Close VR device
|
void CloseVrDevice(void); // Close VR device
|
||||||
bool IsVrDeviceReady(void); // Detect if VR device (or simulator) is ready
|
bool IsVrDeviceReady(void); // Detect if VR device (or simulator) is ready
|
||||||
void UpdateVrTracking(void); // Update VR tracking (position and orientation)
|
void UpdateVrTracking(Camera *camera); // Update VR tracking (position and orientation) and camera
|
||||||
void ToggleVrMode(void); // Enable/Disable VR experience (device or simulator)
|
void ToggleVrMode(void); // Enable/Disable VR experience (device or simulator)
|
||||||
|
|
||||||
// Oculus Rift API for direct access the device (no simulator)
|
// Oculus Rift API for direct access the device (no simulator)
|
||||||
|
Reference in New Issue
Block a user