本文整理汇总了C++中Viewer::configureScreenshot方法的典型用法代码示例。如果您正苦于以下问题:C++ Viewer::configureScreenshot方法的具体用法?C++ Viewer::configureScreenshot怎么用?C++ Viewer::configureScreenshot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Viewer
的用法示例。
在下文中一共展示了Viewer::configureScreenshot方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
if (!success) {
#if MFluidSolver_LOG_LEVEL <= MFluidSolver_LOG_ERROR
std::cerr << "ERROR: Failed to parse config file " <<
configJSON.c_str() << std::endl;
#endif
}
// Parse JSON
std::string sceneJSON = root.get(
"sceneJSON", MFluidSolver_DEFAULT_SCENE_FILE).asString();
std::string wireVShader = root.get(
"wireVShader", MFluidSolver_DEFAULT_WIRE_VERT_FILE).asString();
std::string wireFShader = root.get(
"wireFShader", MFluidSolver_DEFAULT_WIRE_FRAG_FILE).asString();
std::string particleVShader = root.get(
"particleVShader", MFluidSolver_DEFAULT_PARTICLE_VERT_FILE).asString();
std::string particleFShader = root.get(
"particleFShader", MFluidSolver_DEFAULT_PARTICLE_FRAG_FILE).asString();
std::string particleTexture = root.get(
"particleTexture", MFluidSolver_DEFAULT_PARTICLE_TEX_FILE).asString();
bool autoRender = root.get(
"autoRender", MFluidSolver_DEFAULT_AUTORENDER).asBool();
unsigned int renderSkip = root.get(
"renderSkip", MFluidSolver_DEFAULT_RENDERSKIP).asInt();
// Initialize project objects
Viewer viewer;
Input::viewer = &viewer;
try {
viewer.init();
} catch (std::exception &e) {
#if MFluidSolver_LOG_LEVEL <= MFluidSolver_LOG_FATAL
std::cerr << "FATAL: " << e.what() << std::endl;
#endif
return -1;
}
// Print OpenGL info
#if MFluidSolver_LOG_LEVEL <= MFluidSolver_LOG_INFO
std::cout << "INFO: OpenGL Version " << glGetString(GL_VERSION) << std::endl;
#endif
// Set a few settings/modes in OpenGL rendering
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
glEnable(GL_LINE_SMOOTH);
glEnable(GL_POLYGON_SMOOTH);
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
// Set the size with which points should be rendered
glPointSize(MFluidSolver_DEFAULT_POINT_SIZE);
// Set background color
glClearColor(MFluidSolver_DEFAULT_BG_COLOR_R,
MFluidSolver_DEFAULT_BG_COLOR_G,
MFluidSolver_DEFAULT_BG_COLOR_B,
0.0f);
// Bind vertex array object
GLuint vaoID;
glGenVertexArrays(1, &vaoID);
glBindVertexArray(vaoID);
// After vertex array object init
viewer.wireShader = new ShaderProgram(wireVShader, wireFShader);
viewer.particleShader =
new ParticleShaderProgram(&(viewer.scene.solver),
particleVShader, particleFShader, particleTexture);
viewer.scene.solver.loadConfig(configJSON);
viewer.configureScreenshot(autoRender, renderSkip);
// Run! Catch and print exceptions as necessary
int returnCode = 0;
#if MFluidSolver_MAIN_CATCH_EXCEPTIONS
try {
#endif
viewer.scene.loadJSON(sceneJSON);
viewer.particleShader->init();
viewer.run();
#if MFluidSolver_MAIN_CATCH_EXCEPTIONS
} catch (std::exception &e) {
#if MFluidSolver_LOG_LEVEL <= MFluidSolver_LOG_FATAL
std::cerr << "FATAL: " << e.what() << std::endl;
#endif
returnCode = -1;
}
#endif
// Performance
#if MFluidSolver_RECORD_PERFORMANCE
viewer.scene.solver.endSimulation();
viewer.scene.solver.printPerformanceStats();
#endif
// Cleanup
glDeleteVertexArrays(1, &vaoID);
return returnCode;
}