本文整理汇总了C++中FluidSim::outputObj方法的典型用法代码示例。如果您正苦于以下问题:C++ FluidSim::outputObj方法的具体用法?C++ FluidSim::outputObj怎么用?C++ FluidSim::outputObj使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FluidSim
的用法示例。
在下文中一共展示了FluidSim::outputObj方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char** argv)
{
bool run = GL_TRUE;
if(!glfwInit())
{
exit(EXIT_FAILURE);
}
if(!glfwOpenWindow(windows_width, windows_height, 8, 8, 8, 8, 24, 0, GLFW_WINDOW))
{
glfwTerminate();
exit(EXIT_FAILURE);
}
glewInit();
if (!glewIsSupported( "GL_VERSION_2_0 "
"GL_ARB_pixel_buffer_object"
)) {
fprintf( stderr, "ERROR: Support for necessary OpenGL extensions missing.");
fflush( stderr);
return false;
}
//glfwSetKeyCallback(Viewer::keyCallback);
//glfwSetMouseButtonCallback(Viewer::mouseButtonCallback);
//glfwSetMousePosCallback(Viewer::mousePosCallback);
//glfwSetMouseWheelCallback(Viewer::mouseWheelCallback);
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
FluidSim sph;
sph.initialize();
sph.resetFrameNum();
sph.outputObj(true);
vec3 center(0.0f, -0.15f, 0.0f);
Viewer::camera()->setFocal(center.x, center.y, center.z);
Viewer::camera()->resetLookAt();
old_now = glfwGetTime();
while(run)
{
unsigned int frame_num = sph.getFrameNum();
if(frame_num > 450)
exit(0);
Viewer::camera()->aim();
printf("frame number: %d\n", frame_num);
sph.compute(0.004);
sph.draw();
utils::drawAxis();
utils::grabScreen(windows_width, windows_height, sph.getFrameNum());
now = glfwGetTime();
char fpsInfo[256];
sprintf(fpsInfo, "Frame: %u. Time cost per frame: %f", frame_num, now - old_now);
old_now = now;
glfwSetWindowTitle(fpsInfo);
glfwSwapBuffers();
run = !glfwGetKey(GLFW_KEY_ESC) && glfwGetWindowParam(GLFW_OPENED);
}
glfwTerminate();
exit(EXIT_SUCCESS);
}