Use CHECK_ERROR on every GL call

This commit is contained in:
Leith Bade
2014-12-10 21:32:11 +11:00
parent 392150dd48
commit 0808485453
36 changed files with 365 additions and 355 deletions

View File

@@ -18,7 +18,7 @@ void Painter::renderTileDebug(const Tile& tile) {
void Painter::renderDebugText(DebugBucket& bucket, const mat4 &matrix) {
gl::group group("debug text");
glDisable(GL_DEPTH_TEST);
CHECK_ERROR(glDisable(GL_DEPTH_TEST));
useProgram(plainShader->program);
plainShader->u_matrix = matrix;
@@ -30,7 +30,7 @@ void Painter::renderDebugText(DebugBucket& bucket, const mat4 &matrix) {
#ifndef GL_ES_VERSION_2_0
// Draw line "end caps"
glPointSize(2);
CHECK_ERROR(glPointSize(2));
bucket.drawPoints(*plainShader);
#endif
@@ -39,7 +39,7 @@ void Painter::renderDebugText(DebugBucket& bucket, const mat4 &matrix) {
lineWidth(2.0f * state.getPixelRatio());
bucket.drawLines(*plainShader);
glEnable(GL_DEPTH_TEST);
CHECK_ERROR(glEnable(GL_DEPTH_TEST));
}
void Painter::renderDebugFrame(const mat4 &matrix) {
@@ -48,7 +48,7 @@ void Painter::renderDebugFrame(const mat4 &matrix) {
// Disable depth test and don't count this towards the depth buffer,
// but *don't* disable stencil test, as we want to clip the red tile border
// to the tile viewport.
glDisable(GL_DEPTH_TEST);
CHECK_ERROR(glDisable(GL_DEPTH_TEST));
useProgram(plainShader->program);
plainShader->u_matrix = matrix;
@@ -57,9 +57,9 @@ void Painter::renderDebugFrame(const mat4 &matrix) {
tileBorderArray.bind(*plainShader, tileBorderBuffer, BUFFER_OFFSET(0));
plainShader->u_color = {{ 1.0f, 0.0f, 0.0f, 1.0f }};
lineWidth(4.0f * state.getPixelRatio());
glDrawArrays(GL_LINE_STRIP, 0, (GLsizei)tileBorderBuffer.index());
CHECK_ERROR(glDrawArrays(GL_LINE_STRIP, 0, (GLsizei)tileBorderBuffer.index()));
glEnable(GL_DEPTH_TEST);
CHECK_ERROR(glEnable(GL_DEPTH_TEST));
}
void Painter::renderDebugText(const std::vector<std::string> &strings) {
@@ -69,8 +69,8 @@ void Painter::renderDebugText(const std::vector<std::string> &strings) {
gl::group group("debug text");
glDisable(GL_DEPTH_TEST);
glStencilFunc(GL_ALWAYS, 0xFF, 0xFF);
CHECK_ERROR(glDisable(GL_DEPTH_TEST));
CHECK_ERROR(glStencilFunc(GL_ALWAYS, 0xFF, 0xFF));
useProgram(plainShader->program);
plainShader->u_matrix = nativeMatrix;
@@ -88,15 +88,15 @@ void Painter::renderDebugText(const std::vector<std::string> &strings) {
debugFontArray.bind(*plainShader, debugFontBuffer, BUFFER_OFFSET(0));
plainShader->u_color = {{ 1.0f, 1.0f, 1.0f, 1.0f }};
lineWidth(4.0f * state.getPixelRatio());
glDrawArrays(GL_LINES, 0, (GLsizei)debugFontBuffer.index());
CHECK_ERROR(glDrawArrays(GL_LINES, 0, (GLsizei)debugFontBuffer.index()));
#ifndef GL_ES_VERSION_2_0
glPointSize(2);
glDrawArrays(GL_POINTS, 0, (GLsizei)debugFontBuffer.index());
CHECK_ERROR(glPointSize(2));
CHECK_ERROR(glDrawArrays(GL_POINTS, 0, (GLsizei)debugFontBuffer.index()));
#endif
plainShader->u_color = {{ 0.0f, 0.0f, 0.0f, 1.0f }};
lineWidth(2.0f * state.getPixelRatio());
glDrawArrays(GL_LINES, 0, (GLsizei)debugFontBuffer.index());
CHECK_ERROR(glDrawArrays(GL_LINES, 0, (GLsizei)debugFontBuffer.index()));
}
glEnable(GL_DEPTH_TEST);
CHECK_ERROR(glEnable(GL_DEPTH_TEST));
}