Skip to content

Commit 8746f3c

Browse files
committed
clean up print statements
1 parent f075418 commit 8746f3c

File tree

6 files changed

+25
-37
lines changed

6 files changed

+25
-37
lines changed

src/color_management.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
#include <cmath>
1010
#include <iostream>
1111

12-
using std::cout;
13-
using std::endl;
14-
1512
namespace polyscope {
1613

1714
namespace {

src/curve_network_scalar_quantity.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77

88
#include "imgui.h"
99

10-
using std::cout;
11-
using std::endl;
12-
1310
namespace polyscope {
1411

1512
CurveNetworkScalarQuantity::CurveNetworkScalarQuantity(std::string name, CurveNetwork& network_, std::string definedOn_,

src/render/mock_opengl/mock_gl_engine.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1555,9 +1555,7 @@ MockGLEngine::MockGLEngine() {}
15551555

15561556
void MockGLEngine::initialize() {
15571557

1558-
if (options::verbosity > 0) {
1559-
std::cout << options::printPrefix << "Backend: openGL_mock" << std::endl;
1560-
}
1558+
info(0, "Backend: openGL_mock");
15611559

15621560
GLFrameBuffer* glScreenBuffer = new GLFrameBuffer(view::bufferWidth, view::bufferHeight, true);
15631561
displayBuffer.reset(glScreenBuffer);

src/render/opengl/gl_engine_egl.cpp

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <cctype>
1616
#include <dlfcn.h>
1717
#include <set>
18+
#include <sstream>
1819
#include <string>
1920

2021
#include <EGL/egl.h>
@@ -120,9 +121,8 @@ void GLEngineEGL::checkEGLError(bool fatal) {
120121
break;
121122
}
122123

123-
if (polyscope::options::verbosity > 0) {
124-
std::cout << polyscope::options::printPrefix << "EGL Error! Type: " << errText << std::endl;
125-
}
124+
info(0, "EGL Error! Type: " + errText);
125+
126126
if (fatal) {
127127
exception("EGL error occurred. Text: " + errText);
128128
}
@@ -248,10 +248,13 @@ void GLEngineEGL::initialize() {
248248
exception(options::printPrefix + "ERROR: Failed to load openGL using GLAD");
249249
}
250250
#endif
251-
if (options::verbosity > 0) {
252-
std::cout << options::printPrefix << "Backend: openGL3_egl -- "
253-
<< "Loaded openGL version: " << glGetString(GL_VERSION) << " -- "
254-
<< "EGL version: " << majorVer << "." << minorVer << std::endl;
251+
252+
{
253+
std::stringstring ss;
254+
ss << "Backend: openGL3_egl -- "
255+
<< "Loaded openGL version: " << glGetString(GL_VERSION) << " -- "
256+
<< "EGL version: " << majorVer << "." << minorVer;
257+
info(0, ss.str());
255258
}
256259

257260
{ // Manually create the screen frame buffer
@@ -325,9 +328,9 @@ void GLEngineEGL::resolveEGL() {
325328
}
326329
error("EGL: Error loading symbol " + errText);
327330
}
328-
if (options::verbosity > 5) {
329-
std::cout << polyscope::options::printPrefix << " ...resolved EGL functions" << std::endl;
330-
}
331+
332+
info(5, "...resolved EGL functions");
333+
331334
// ... at this point, we have essentially loaded libEGL.so
332335

333336
// === Resolve EGL extension functions
@@ -405,7 +408,8 @@ void GLEngineEGL::sortAvailableDevicesByPreference(
405408

406409
// at high verbosity levels, log the priority
407410
if (polyscope::options::verbosity > 5) {
408-
info(5, "EGLDevice " + std::to_string(iDevice) + " -- vendor: " + vendorStr + " priority score: " + std::to_string(score));
411+
info(5, "EGLDevice " + std::to_string(iDevice) + " -- vendor: " + vendorStr +
412+
" priority score: " + std::to_string(score));
409413
}
410414

411415
scoreDevices.emplace_back(score, iDevice);

src/render/opengl/gl_engine_glfw.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#include <algorithm>
1414
#include <set>
15+
#include <sstream>
1516

1617
namespace polyscope {
1718
namespace render {
@@ -35,9 +36,7 @@ void GLEngineGLFW::initialize() {
3536

3637
// Small callback function for GLFW errors
3738
auto error_print_callback = [](int error, const char* description) {
38-
if (polyscope::options::verbosity > 0) {
39-
std::cout << "GLFW emitted error: " << description << std::endl;
40-
}
39+
info(0, "GLFW emitted error: " + std::string(description));
4140
};
4241

4342
// === Initialize glfw
@@ -79,9 +78,12 @@ void GLEngineGLFW::initialize() {
7978
exception("ERROR: Failed to load openGL using GLAD");
8079
}
8180
#endif
82-
if (options::verbosity > 0) {
83-
std::cout << options::printPrefix << "Backend: openGL3_glfw -- "
84-
<< "Loaded openGL version: " << glGetString(GL_VERSION) << std::endl;
81+
82+
{
83+
std::stringstream ss;
84+
ss << "Backend: openGL3_glfw -- "
85+
<< "Loaded openGL version: " << glGetString(GL_VERSION);
86+
info(0, ss.str());
8587
}
8688

8789
#ifdef __APPLE__

src/render/shader_builder.cpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,9 @@ std::vector<ShaderStageSpecification>
1212
applyShaderReplacements(const std::vector<ShaderStageSpecification>& stages,
1313
const std::vector<ShaderReplacementRule>& replacementRules) {
1414

15-
bool debugPrint = false;
16-
1715
// accumulate the text to be inserted at each tag from all of the rules
1816
std::map<std::string, std::string> replacements;
1917
for (const ShaderReplacementRule& rule : replacementRules) {
20-
if (debugPrint) std::cout << "Replacement rule: " << rule.ruleName << std::endl;
2118

2219
for (const std::pair<std::string, std::string>& r : rule.replacements) {
2320
std::string key = r.first;
@@ -42,8 +39,6 @@ applyShaderReplacements(const std::vector<ShaderStageSpecification>& stages,
4239

4340
while (!progText.empty()) {
4441

45-
if (debugPrint) std::cout << "searching " << progText << std::endl;
46-
4742
// Find the next tag in the program
4843
auto tagStart = progText.find(startTagToken);
4944
auto tagEnd = progText.find(endTagToken);
@@ -57,20 +52,15 @@ applyShaderReplacements(const std::vector<ShaderStageSpecification>& stages,
5752
progText = "";
5853
} else {
5954

60-
if (debugPrint) std::cout << "FOUND TAG: " << tagStart << " " << tagEnd << std::endl;
61-
6255
std::string srcBefore = progText.substr(0, tagStart);
6356
std::string tag = progText.substr(tagStart + startTagToken.size(), tagEnd - (tagStart + startTagToken.size()));
6457
std::string srcAfter = progText.substr(tagEnd + endTagToken.size(), npos);
6558

66-
if (debugPrint) std::cout << " TAG NAME: [" << tag << "]\n";
67-
6859
resultText += srcBefore + "\n// tag ${ " + tag + " }$\n";
6960
if (replacements.find(tag) != replacements.end()) {
7061
resultText += replacements[tag];
71-
// std::cout << " ADDING REPLACEMENT: [" << replacements[tag] << "]\n";
7262
}
73-
// resultText += "// END ADDIITIONS FROM TAG ${ " + tag + " $}\n";
63+
7464
progText = srcAfter; // continue processing the remaining program text
7565
}
7666
}

0 commit comments

Comments
 (0)