Orthographic Projection
Hi Everyone,
Apologies if this has been asked before, but I'm struggling to find an answer and Google isn't throwing much up!
We already have a stereo rendering path in our code which we are reusing for the Oculus. This means we end up with a texture for each eye with the correctly separated image drawn on it.
From the Oculus SDK we have a single texture that we glViewport/glScissor as appropriate for each eye and draw the textures from stage 1 into the Oculus texture.
On the headset we get the correct images in each eye piece, however as expected they don't align properly as they've not had a correct projection matrix applied to them to ensure alignment.
Our current texture quad renderer does a ModelView matrix -> Identity and a ProjectionMatrix -> Identity followed by glOrtho(0,1,1,0,-1,1).
My guess is we need to replace the glOrtho call with an ortho matrix supplied by the Oculus SDK. Indeed there is even a function for this ovrMatrix4f_OrthoSubProjection.
However no matter what I do with the matrix supplied by this method I can't get anything rendered in to the Oculus.. so I'm a bit stumped how to use this matrix. I've tried loading it, I've tried multiplying the current glOrtho matrix all to no avail.
Does anybody have an example of how to use this matrix to correctly render 2D full screen textures to each eye piece of the Oculus?
Or have I over thought this and missed something obvious??
Many Thanks
Mark
Apologies if this has been asked before, but I'm struggling to find an answer and Google isn't throwing much up!
We already have a stereo rendering path in our code which we are reusing for the Oculus. This means we end up with a texture for each eye with the correctly separated image drawn on it.
From the Oculus SDK we have a single texture that we glViewport/glScissor as appropriate for each eye and draw the textures from stage 1 into the Oculus texture.
On the headset we get the correct images in each eye piece, however as expected they don't align properly as they've not had a correct projection matrix applied to them to ensure alignment.
Our current texture quad renderer does a ModelView matrix -> Identity and a ProjectionMatrix -> Identity followed by glOrtho(0,1,1,0,-1,1).
My guess is we need to replace the glOrtho call with an ortho matrix supplied by the Oculus SDK. Indeed there is even a function for this ovrMatrix4f_OrthoSubProjection.
However no matter what I do with the matrix supplied by this method I can't get anything rendered in to the Oculus.. so I'm a bit stumped how to use this matrix. I've tried loading it, I've tried multiplying the current glOrtho matrix all to no avail.
Does anybody have an example of how to use this matrix to correctly render 2D full screen textures to each eye piece of the Oculus?
Or have I over thought this and missed something obvious??
Many Thanks
Mark
