Code-style consistency improvement:

Apply clang-format-all.sh using the _clang-format file through all the cpp/.h files.
make sure not to apply it to certain serialization structures, since some parser expects the * as part of the name, instead of type.
This commit contains no other changes aside from adding and applying clang-format-all.sh
This commit is contained in:
erwincoumans
2018-09-23 14:17:31 -07:00
parent b73b05e9fb
commit ab8f16961e
1773 changed files with 1081087 additions and 474249 deletions

View File

@@ -2,28 +2,26 @@
///See http://www.opengl-tutorial.org/intermediate-tutorials/tutorial-14-render-to-texture/
#include "GLRenderToTexture.h"
#include "Bullet3Common/b3Scalar.h" // for b3Assert
#include "Bullet3Common/b3Scalar.h" // for b3Assert
#include <string.h>
#include <stdio.h>
bool gIntelLinuxglDrawBufferWorkaround=false;
bool gIntelLinuxglDrawBufferWorkaround = false;
GLRenderToTexture::GLRenderToTexture()
:m_framebufferName(0)
: m_framebufferName(0)
{
#if !defined(_WIN32) && !defined(__APPLE__)
const GLubyte* ven = glGetString(GL_VENDOR);
printf("ven = %s\n",ven);
if (strncmp((const char*)ven,"Intel",5)==0)
{
printf("Workaround for some crash in the Intel OpenGL driver on Linux/Ubuntu\n");
gIntelLinuxglDrawBufferWorkaround=true;
}
#endif//!defined(_WIN32) && !defined(__APPLE__)
const GLubyte* ven = glGetString(GL_VENDOR);
printf("ven = %s\n", ven);
if (strncmp((const char*)ven, "Intel", 5) == 0)
{
printf("Workaround for some crash in the Intel OpenGL driver on Linux/Ubuntu\n");
gIntelLinuxglDrawBufferWorkaround = true;
}
#endif //!defined(_WIN32) && !defined(__APPLE__)
}
void GLRenderToTexture::init(int width, int height, GLuint textureId, int renderTextureType)
@@ -33,18 +31,16 @@ void GLRenderToTexture::init(int width, int height, GLuint textureId, int render
glGenFramebuffers(1, &m_framebufferName);
glBindFramebuffer(GL_FRAMEBUFFER, m_framebufferName);
// The depth buffer
// glGenRenderbuffers(1, &m_depthrenderbuffer);
// 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);
// glBindRenderbuffer(GL_RENDERBUFFER, m_depthrenderbuffer);
// glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT, width, height);
// glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, m_depthrenderbuffer);
switch (m_renderTextureType)
switch (m_renderTextureType)
{
case RENDERTEXTURE_COLOR:
case RENDERTEXTURE_COLOR:
{
glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, textureId, 0);
break;
@@ -55,15 +51,12 @@ void GLRenderToTexture::init(int width, int height, GLuint textureId, int render
break;
}
default:
{
{
b3Assert(0);
}
}
};
glBindFramebuffer( GL_FRAMEBUFFER, 0 );
glBindFramebuffer(GL_FRAMEBUFFER, 0);
}
bool GLRenderToTexture::enable()
@@ -72,13 +65,12 @@ bool GLRenderToTexture::enable()
glBindFramebuffer(GL_FRAMEBUFFER, m_framebufferName);
switch (m_renderTextureType)
{
case RENDERTEXTURE_COLOR:
case RENDERTEXTURE_COLOR:
{
// Set the list of draw buffers.
GLenum drawBuffers[2] = {GL_COLOR_ATTACHMENT0,0};
GLenum drawBuffers[2] = {GL_COLOR_ATTACHMENT0, 0};
glDrawBuffers(1, drawBuffers);
break;
}
@@ -87,51 +79,47 @@ 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_COLOR_ATTACHMENT0,0};
glDrawBuffers(1, drawBuffers);
} else
GLenum drawBuffers[2] = {GL_COLOR_ATTACHMENT0, 0};
glDrawBuffers(1, drawBuffers);
}
else
{
glDrawBuffer(GL_NONE);
}
break;
}
default:
{
{
b3Assert(0);
}
}
};
// Always check that our framebuffer is ok
if(glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE)
if (glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE)
{
status = true;
}
return status;
}
void GLRenderToTexture::disable()
{
glBindFramebuffer( GL_FRAMEBUFFER, 0 );
glBindFramebuffer(GL_FRAMEBUFFER, 0);
}
GLRenderToTexture::~GLRenderToTexture()
{
glBindFramebuffer( GL_FRAMEBUFFER, 0 );
glBindFramebuffer(GL_FRAMEBUFFER, 0);
if (m_depthrenderbuffer)
{
glDeleteRenderbuffers(1,&m_depthrenderbuffer);
glDeleteRenderbuffers(1, &m_depthrenderbuffer);
}
if( m_framebufferName)
if (m_framebufferName)
{
glDeleteFramebuffers(1, &m_framebufferName);
}
}
#endif