Partial implementation of row interlaced mode.

This commit is contained in:
Christopher Bruns 2016-09-27 19:49:24 -04:00
parent 960d4d6755
commit 79046580d5
3 changed files with 27 additions and 8 deletions

View file

@ -576,6 +576,26 @@ void FGLRenderBuffers::BlitToEyeTexture(int eye)
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
}
void FGLRenderBuffers::BlitFromEyeTexture(int eye, GL_IRECT* box)
{
glBindFramebuffer(GL_READ_FRAMEBUFFER, mEyeFBs[eye]);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, mOutputFB);
if (box == nullptr)
box = &GLRenderer->mOutputLetterbox;
glBlitFramebuffer(0, 0, mWidth, mHeight,
box->left, box->top, box->width + box->left, box->height + box->top,
GL_COLOR_BUFFER_BIT, GL_NEAREST);
if ((gl.flags & RFL_INVALIDATE_BUFFER) != 0)
{
GLenum attachments[2] = { GL_COLOR_ATTACHMENT0, GL_DEPTH_STENCIL_ATTACHMENT };
glInvalidateFramebuffer(GL_READ_FRAMEBUFFER, 2, attachments);
}
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
}
void FGLRenderBuffers::BindEyeTexture(int eye, int texunit)
{
CreateEyeBuffers(eye);

View file

@ -2,6 +2,7 @@
#define __GL_RENDERBUFFERS_H
#include "gl/shaders/gl_shader.h"
#include "gl/renderer/gl_renderer.h"
class FGLBloomTextureLevel
{
@ -42,6 +43,7 @@ public:
void BindOutputFB();
void BlitToEyeTexture(int eye);
void BlitFromEyeTexture(int eye, GL_IRECT* box);
void BindEyeTexture(int eye, int texunit);
void BindEyeFB(int eye, bool readBuffer = false);

View file

@ -53,18 +53,15 @@ void RowInterleaved3D::Present() const
// Compute screen regions to use for left and right eye views
int topHeight = GLRenderer->mOutputLetterbox.height / 2;
int bottomHeight = GLRenderer->mOutputLetterbox.height - topHeight;
GL_IRECT topHalfScreen = GLRenderer->mOutputLetterbox;
topHalfScreen.height = topHeight;
topHalfScreen.top = topHeight;
GL_IRECT bottomHalfScreen = GLRenderer->mOutputLetterbox;
bottomHalfScreen.height = bottomHeight;
bottomHalfScreen.top += topHeight;
bottomHalfScreen.height = topHeight;
bottomHalfScreen.top = 0;
GLRenderer->mBuffers->BindEyeTexture(0, 0);
GLRenderer->DrawPresentTexture(topHalfScreen, true);
GLRenderer->mBuffers->BindEyeTexture(1, 0);
GLRenderer->DrawPresentTexture(bottomHalfScreen, true);
GLRenderer->mBuffers->BlitFromEyeTexture(0, &topHalfScreen);
GLRenderer->mBuffers->BlitFromEyeTexture(1, &bottomHalfScreen);
}