aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorraysan5 <raysan5@gmail.com>2016-06-26 14:13:11 +0200
committerraysan5 <raysan5@gmail.com>2016-06-26 14:13:11 +0200
commit8652e644dd9f013464ac1cf1bf9f643637209ff8 (patch)
tree582d629fe3632d2b20f6832e00b5860344ebdba5 /src
parent4ff85c2ac257eb5494626dae30e79c5f48430609 (diff)
downloadraylib-8652e644dd9f013464ac1cf1bf9f643637209ff8.tar.gz
raylib-8652e644dd9f013464ac1cf1bf9f643637209ff8.zip
Corrected bug on stereo rendering
Diffstat (limited to 'src')
-rw-r--r--src/core.c2
-rw-r--r--src/rlgl.c12
-rw-r--r--src/rlgl.h2
3 files changed, 8 insertions, 8 deletions
diff --git a/src/core.c b/src/core.c
index f02178c5..47ce5cea 100644
--- a/src/core.c
+++ b/src/core.c
@@ -1774,7 +1774,7 @@ static void InitGraphicsDevice(int width, int height)
#endif // defined(PLATFORM_ANDROID) || defined(PLATFORM_RPI)
// Initialize OpenGL context (states and resources)
- rlglInit();
+ rlglInit(screenWidth, screenHeight);
// Initialize screen viewport (area of the screen that you will actually draw to)
// NOTE: Viewport must be recalculated if screen is resized
diff --git a/src/rlgl.c b/src/rlgl.c
index 99afd681..ea65b6a4 100644
--- a/src/rlgl.c
+++ b/src/rlgl.c
@@ -485,10 +485,6 @@ void rlOrtho(double left, double right, double bottom, double top, double near,
void rlViewport(int x, int y, int width, int height)
{
glViewport(x, y, width, height);
-
- // Store default framebuffer size
- screenWidth = width;
- screenHeight = height;
}
//----------------------------------------------------------------------------------
@@ -952,7 +948,7 @@ int rlGetVersion(void)
//----------------------------------------------------------------------------------
// Initialize rlgl: OpenGL extensions, default buffers/shaders/textures, OpenGL states
-void rlglInit(void)
+void rlglInit(int width, int height)
{
// Check OpenGL information and capabilities
//------------------------------------------------------------------------------
@@ -1167,6 +1163,10 @@ void rlglInit(void)
glClearColor(0.0f, 0.0f, 0.0f, 1.0f); // Set clear color (black)
glClearDepth(1.0f); // Set clear depth value (default)
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear color and depth buffers (depth buffer required for 3D)
+
+ // Store screen size into global variables
+ screenWidth = width;
+ screenHeight = height;
TraceLog(INFO, "OpenGL default states initialized successfully");
}
@@ -2524,7 +2524,7 @@ void InitOculusDevice(void)
if (!oculusEnabled)
{
TraceLog(WARNING, "VR: Initializing Oculus simulator");
-
+
// Initialize framebuffer and textures for stereo rendering
stereoFbo = rlglLoadRenderTexture(screenWidth, screenHeight);
diff --git a/src/rlgl.h b/src/rlgl.h
index 61d11d66..0f9c7a80 100644
--- a/src/rlgl.h
+++ b/src/rlgl.h
@@ -298,7 +298,7 @@ int rlGetVersion(void); // Returns current OpenGL versio
//------------------------------------------------------------------------------------
// Functions Declaration - rlgl functionality
//------------------------------------------------------------------------------------
-void rlglInit(void); // Initialize rlgl (shaders, VAO, VBO...)
+void rlglInit(int width, int height); // Initialize rlgl (buffers, shaders, textures, states)
void rlglClose(void); // De-init rlgl
void rlglDraw(void); // Draw VAO/VBO
void rlglLoadExtensions(void *loader); // Load OpenGL extensions