experiments with params in AllBullet2Demos (quick hack for testing, will clean this up soon)

yet another workaround to make Intel GPU work with glDrawBuffers on Ubuntu
This commit is contained in:
Erwin Coumans (Google)
2014-07-08 16:42:57 -07:00
parent f89d70b895
commit 27b0e4d1e6
4 changed files with 120 additions and 28 deletions

View File

@@ -24,19 +24,19 @@ GLRenderToTexture::GLRenderToTexture()
#endif//!defined(_WIN32) && !defined(__APPLE__)
}
void GLRenderToTexture::init(int width, int height, GLuint textureId, int renderTextureType)
{
m_renderTextureType = renderTextureType;
glGenFramebuffers(1, &m_framebufferName);
glBindFramebuffer(GL_FRAMEBUFFER, m_framebufferName);
// The depth buffer
// glGenRenderbuffers(1, &m_depthrenderbuffer);
// glBindRenderbuffer(GL_RENDERBUFFER, m_depthrenderbuffer);
// glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, width, height);
// glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_depthrenderbuffer);
@@ -71,7 +71,7 @@ bool GLRenderToTexture::enable()
glBindFramebuffer(GL_FRAMEBUFFER, m_framebufferName);
switch (m_renderTextureType)
{
case RENDERTEXTURE_COLOR:
@@ -86,11 +86,10 @@ bool GLRenderToTexture::enable()
//Intel OpenGL driver crashes when using GL_NONE for glDrawBuffer on Linux, so use a workaround
if (gIntelLinuxglDrawBufferWorkaround)
{
GLenum drawBuffers[2] = { GL_DEPTH_ATTACHMENT,0};
glDrawBuffers(1, drawBuffers);
GLenum drawBuffers[2] = { GL_COLOR_ATTACHMENT0,0};
glDrawBuffers(1, drawBuffers);
} else
{
{
glDrawBuffer(GL_NONE);
}
break;
@@ -117,7 +116,7 @@ void GLRenderToTexture::disable()
{
glBindFramebuffer( GL_FRAMEBUFFER, 0 );
}
GLRenderToTexture::~GLRenderToTexture()
{
glBindFramebuffer( GL_FRAMEBUFFER, 0 );
@@ -129,7 +128,7 @@ GLRenderToTexture::~GLRenderToTexture()
if( m_framebufferName)
{
{
glDeleteFramebuffers(1, &m_framebufferName);
}
}