From 4189a9a67fb952f2884f453156484f9061fbd2ea Mon Sep 17 00:00:00 2001 From: "Erwin Coumans (Google)" Date: Tue, 24 Jun 2014 20:12:05 -0700 Subject: [PATCH] fix issue with Intel OpenGL 3.x driver under Ubuntu, render to texture cannot handle glDrawBuffer(GL_NONE) --- btgui/OpenGLWindow/GLInstancingRenderer.cpp | 5 ----- btgui/OpenGLWindow/GLRenderToTexture.cpp | 4 +++- btgui/OpenGLWindow/Shaders/createShadowMapInstancingPS.h | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/btgui/OpenGLWindow/GLInstancingRenderer.cpp b/btgui/OpenGLWindow/GLInstancingRenderer.cpp index f5f86e70f..d8789ff08 100644 --- a/btgui/OpenGLWindow/GLInstancingRenderer.cpp +++ b/btgui/OpenGLWindow/GLInstancingRenderer.cpp @@ -802,11 +802,6 @@ void GLInstancingRenderer::InitShaders() glLinkProgram(createShadowMapInstancingShader); glUseProgram(createShadowMapInstancingShader); createShadow_depthMVP = glGetUniformLocation(createShadowMapInstancingShader, "depthMVP"); - if (createShadow_depthMVP==0) - { - printf("Issue with createShadowMapInstancingFragmentShader (createShadow_depthMVP==0), disabling shadow maps\n"); - useShadowMap=false; - } glUseProgram(0); diff --git a/btgui/OpenGLWindow/GLRenderToTexture.cpp b/btgui/OpenGLWindow/GLRenderToTexture.cpp index 332967e5e..aee7e7b40 100644 --- a/btgui/OpenGLWindow/GLRenderToTexture.cpp +++ b/btgui/OpenGLWindow/GLRenderToTexture.cpp @@ -66,7 +66,9 @@ bool GLRenderToTexture::enable() } case RENDERTEXTURE_DEPTH: { - glDrawBuffer(GL_NONE); + GLenum drawBuffers[2] = {GL_DEPTH_ATTACHMENT,0}; + glDrawBuffers(1, drawBuffers); + //glDrawBuffer(GL_NONE); break; } default: diff --git a/btgui/OpenGLWindow/Shaders/createShadowMapInstancingPS.h b/btgui/OpenGLWindow/Shaders/createShadowMapInstancingPS.h index f94672a14..8b2dce8f1 100644 --- a/btgui/OpenGLWindow/Shaders/createShadowMapInstancingPS.h +++ b/btgui/OpenGLWindow/Shaders/createShadowMapInstancingPS.h @@ -5,6 +5,6 @@ static const char* createShadowMapInstancingFragmentShader= \ "layout(location = 0) out float fragmentdepth;\n" "void main(void)\n" "{\n" -" fragmentdepth = gl_FragCoord.z+0.0001*gl_FragCoord.x;\n" +" fragmentdepth = gl_FragCoord.z;\n" "}\n" ;