mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2025-02-22 19:31:17 +00:00
Test double buffer framebuffer
This commit is contained in:
parent
fa25de3f71
commit
70d7ff77aa
2 changed files with 26 additions and 12 deletions
|
@ -62,8 +62,11 @@ namespace OpenGLESRenderer
|
|||
|
||||
void FGLRenderBuffers::ClearScene()
|
||||
{
|
||||
DeleteFrameBuffer(mSceneFB);
|
||||
DeleteRenderBuffer(mSceneDepthStencilBuf);
|
||||
for (int n = 0; n < NBR_BUFF; n++)
|
||||
{
|
||||
DeleteFrameBuffer(mSceneFB[n]);
|
||||
DeleteRenderBuffer(mSceneDepthStencilBuf[n]);
|
||||
}
|
||||
}
|
||||
|
||||
void FGLRenderBuffers::DeleteTexture(PPGLTexture& tex)
|
||||
|
@ -99,6 +102,8 @@ namespace OpenGLESRenderer
|
|||
if (width <= 0 || height <= 0)
|
||||
I_FatalError("Requested invalid render buffer sizes: screen = %dx%d", width, height);
|
||||
|
||||
mBuffPos++;
|
||||
mBuffPos = mBuffPos % NBR_BUFF;
|
||||
|
||||
GLint activeTex;
|
||||
GLint textureBinding;
|
||||
|
@ -142,8 +147,11 @@ namespace OpenGLESRenderer
|
|||
void FGLRenderBuffers::CreateScene(int width, int height)
|
||||
{
|
||||
ClearScene();
|
||||
mSceneDepthStencilBuf = CreateRenderBuffer("SceneDepthStencil", GL_DEPTH24_STENCIL8_OES, width, height);
|
||||
mSceneFB = CreateFrameBuffer("SceneFB", mSceneTex, mSceneDepthStencilBuf);
|
||||
for (int n = 0; n < NBR_BUFF; n++)
|
||||
{
|
||||
mSceneDepthStencilBuf[n] = CreateRenderBuffer("SceneDepthStencil", GL_DEPTH24_STENCIL8_OES, width, height);
|
||||
mSceneFB[n] = CreateFrameBuffer("SceneFB", mSceneTex[n], mSceneDepthStencilBuf[n]);
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -154,7 +162,10 @@ namespace OpenGLESRenderer
|
|||
|
||||
void FGLRenderBuffers::CreatePipeline(int width, int height)
|
||||
{
|
||||
mSceneTex = Create2DTexture("PipelineTexture", GL_RGBA, width, height);
|
||||
for (int n = 0; n < NBR_BUFF; n++)
|
||||
{
|
||||
mSceneTex[n] = Create2DTexture("PipelineTexture", GL_RGBA, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -382,7 +393,7 @@ namespace OpenGLESRenderer
|
|||
|
||||
void FGLRenderBuffers::BindSceneFB(bool sceneData)
|
||||
{
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, mSceneFB.handle);
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, mSceneFB[mBuffPos].handle);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -393,7 +404,7 @@ namespace OpenGLESRenderer
|
|||
|
||||
void FGLRenderBuffers::BindCurrentTexture(int index, int filter, int wrap)
|
||||
{
|
||||
mSceneTex.Bind(index, filter, wrap);
|
||||
mSceneTex[mBuffPos].Bind(index, filter, wrap);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -405,7 +416,7 @@ namespace OpenGLESRenderer
|
|||
void FGLRenderBuffers::BindCurrentFB()
|
||||
{
|
||||
#ifndef NO_RENDER_BUFFER
|
||||
mSceneFB.Bind();
|
||||
mSceneFB[mBuffPos].Bind();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -134,12 +134,15 @@ private:
|
|||
int mSceneWidth = 0;
|
||||
int mSceneHeight = 0;
|
||||
|
||||
static const int NBR_BUFF = 1;
|
||||
|
||||
int mBuffPos = 0;
|
||||
|
||||
// Buffers for the scene
|
||||
PPGLTexture mSceneDepthStencilTex;
|
||||
PPGLTexture mSceneTex;
|
||||
PPGLRenderBuffer mSceneDepthStencilBuf;
|
||||
PPGLFrameBuffer mSceneFB;
|
||||
PPGLTexture mSceneDepthStencilTex[NBR_BUFF];
|
||||
PPGLTexture mSceneTex[NBR_BUFF];
|
||||
PPGLRenderBuffer mSceneDepthStencilBuf[NBR_BUFF];
|
||||
PPGLFrameBuffer mSceneFB[NBR_BUFF];
|
||||
bool mSceneUsesTextures = false;
|
||||
|
||||
PPGLTexture mDitherTexture;
|
||||
|
|
Loading…
Reference in a new issue