本文整理汇总了C++中Voxel::readPngDepthMap方法的典型用法代码示例。如果您正苦于以下问题:C++ Voxel::readPngDepthMap方法的具体用法?C++ Voxel::readPngDepthMap怎么用?C++ Voxel::readPngDepthMap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Voxel
的用法示例。
在下文中一共展示了Voxel::readPngDepthMap方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char** argv)
{
Model = glm::mat4();;
View = glm::mat4();
Projection = glm::mat4();;
if (!glfwInit())
exit(EXIT_FAILURE);
glfwWindowHint(GLFW_CLIENT_API,GLFW_OPENGL_API);
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR,4);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR,4);
glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT,GL_TRUE );
glfwWindowHint(GLFW_OPENGL_PROFILE ,GLFW_OPENGL_CORE_PROFILE);
glfwSetErrorCallback(glfw_error_callback);
GLFWwindow* window = glfwCreateWindow(640, 480, "My Title", NULL, NULL);
if (!window)
{
glfwTerminate();
exit(EXIT_FAILURE);
}
glfwMakeContextCurrent(window);
glfwSetMouseButtonCallback(window, mouse_button_callback);
glfwSetScrollCallback(window, scroll_callback);
glfwSetCursorPosCallback(window, cursor_pos_callback);
glfwSwapInterval(1);
pngObject.readPngDepthMap("1341841873.505863.png");
if (!gladLoadGLLoader((GLADloadproc) glfwGetProcAddress))
{
std::cout << "Failed to initialize OpenGL context" << std::endl;
return -1;
}
//glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
glDebugMessageCallback(openglCallbackFunction, NULL);
GLuint unusedIds = 0;
glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, &unusedIds, true);
init();
int nbFrames;
double currentTime = 0;
double lastTime = 0;
while (!glfwWindowShouldClose(window)){
display();
// Measure speed
double currentTime = glfwGetTime();
nbFrames++;
if (currentTime - lastTime >= 1.0) { // If last cout was more than 1 sec ago
char title[256];
title[255] = '\0';
snprintf(title, 255, "FPS: %d", nbFrames);
glfwSetWindowTitle(window, title);
nbFrames = 0;
lastTime += 1.0;
}
glfwSwapBuffers(window);
glfwPollEvents();
}
glfwDestroyWindow(window);
glfwTerminate();
return 0;
}