#include <math.h>
#include <errno.h>
#include "../libsdl/print.h"
+#include "../libopengl/opengl.h"
#include "ovr.h"
#include <OVR_CAPI.h>
static int initial_observer_reset = 1;
-void begin_render_ovr_eye(int eye, double *camera_x, double *camera_y, double *camera_z)
+void begin_render_ovr_eye(int eye, double *camera_x, double *camera_y, double *camera_z, int *width, int *height)
{
int curIndex;
GLuint chainTexId;
ovr_GetTextureSwapChainCurrentIndex(session, textureSwapChain[eye], &curIndex);
ovr_GetTextureSwapChainBufferGL(session, textureSwapChain[eye], curIndex, &chainTexId);
glBindFramebuffer(GL_FRAMEBUFFER, fboId[eye]);
+ current_framebuffer = fboId[eye];
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, (multisampling > 1) ? GL_TEXTURE_2D_MULTISAMPLE : GL_TEXTURE_2D, chainTexId, 0);
glViewport(0, 0, TextureSize[eye].w, TextureSize[eye].h);
+ *width = TextureSize[eye].w;
+ *height = TextureSize[eye].h;
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum(
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, (multisampling > 1) ? GL_TEXTURE_2D_MULTISAMPLE : GL_TEXTURE_2D, 0, 0);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, (multisampling > 1) ? GL_TEXTURE_2D_MULTISAMPLE : GL_TEXTURE_2D, 0, 0);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
+ current_framebuffer = 0;
// Commit the changes to the texture swap chain
ovr_CommitTextureSwapChain(session, textureSwapChain[eye]);