Push/pop draw FBO and render in-program overlay to default FBO

This commit is contained in:
baldurk
2015-08-08 14:53:30 -07:00
parent d3ea351c5b
commit 3616524484
+11
View File
@@ -1305,6 +1305,7 @@ struct RenderTextState
GLuint prog;
GLuint pipe;
GLuint VAO;
GLuint drawFBO;
// if this context wasn't created with CreateContextAttribs we
// do an immediate mode render, so fewer states are pushed/popped.
@@ -1396,6 +1397,9 @@ struct RenderTextState
prog = 0;
gl.glGetIntegerv(eGL_CURRENT_PROGRAM, (GLint *)&prog);
drawFBO = 0;
gl.glGetIntegerv(eGL_DRAW_FRAMEBUFFER_BINDING, (GLint *)&drawFBO);
// since we will use the fixed function pipeline, also need to check for
// program pipeline bindings (if we weren't, our program would override)
pipe = 0;
@@ -1457,6 +1461,9 @@ struct RenderTextState
gl.glBindTexture(eGL_TEXTURE_2D, tex0);
gl.glActiveTexture(ActiveTexture);
if(drawFBO != 0 && gl.glBindFramebuffer)
gl.glBindFramebuffer(eGL_DRAW_FRAMEBUFFER, drawFBO);
if(modern)
{
gl.glBindBufferBase(eGL_UNIFORM_BUFFER, 0, ubo[0]);
@@ -1591,6 +1598,8 @@ void WrappedOpenGL::RenderOverlayStr(float x, float y, const char *text)
gl.glDisable(eGL_STENCIL_TEST);
gl.glDisable(eGL_CULL_FACE);
gl.glBindFramebuffer(eGL_DRAW_FRAMEBUFFER, 0);
// set viewport & scissor
gl.glViewportIndexedf(0, 0.0f, 0.0f, (float)m_InitParams.width, (float)m_InitParams.height);
gl.glDisablei(eGL_SCISSOR_TEST, 0);
@@ -1652,6 +1661,8 @@ void WrappedOpenGL::RenderOverlayStr(float x, float y, const char *text)
gl.glBindTexture(eGL_TEXTURE_2D, ctxdata.GlyphTexture);
gl.glEnable(eGL_TEXTURE_2D);
gl.glBindFramebuffer(eGL_DRAW_FRAMEBUFFER, 0);
// just in case, try to disable the programmable pipeline
if(gl.glUseProgram)
gl.glUseProgram(0);