Fix compilation errors on Linux and issue in CMakeLists file of raycast example

This commit is contained in:
Daniel Chappuis 2015-01-31 02:12:56 +01:00
parent 111eec63fe
commit 3b2ce61cf2
2 changed files with 10 additions and 5 deletions

View File

@ -27,6 +27,8 @@
#include "Viewer.h" #include "Viewer.h"
#include "openglframework.h" #include "openglframework.h"
#include <iostream> #include <iostream>
#include <cstdlib>
#include <sstream>
using namespace openglframework; using namespace openglframework;
@ -60,7 +62,7 @@ void Viewer::init(int argc, char** argv, const std::string& windowsTitle,
// Initialize the GLFW library // Initialize the GLFW library
if (!glfwInit()) { if (!glfwInit()) {
exit(EXIT_FAILURE); std::exit(EXIT_FAILURE);
} }
// Active the multi-sampling by default // Active the multi-sampling by default
@ -73,7 +75,7 @@ void Viewer::init(int argc, char** argv, const std::string& windowsTitle,
static_cast<int>(windowsSize.y), mWindowTitle.c_str(), NULL, NULL); static_cast<int>(windowsSize.y), mWindowTitle.c_str(), NULL, NULL);
if (!mWindow) { if (!mWindow) {
glfwTerminate(); glfwTerminate();
exit(EXIT_FAILURE); std::exit(EXIT_FAILURE);
} }
glfwMakeContextCurrent(mWindow); glfwMakeContextCurrent(mWindow);
@ -87,7 +89,7 @@ void Viewer::init(int argc, char** argv, const std::string& windowsTitle,
// Problem: glewInit failed, something is wrong // Problem: glewInit failed, something is wrong
std::cerr << "GLEW Error : " << glewGetErrorString(errorGLEW) << std::endl; std::cerr << "GLEW Error : " << glewGetErrorString(errorGLEW) << std::endl;
assert(false); assert(false);
exit(EXIT_FAILURE); std::exit(EXIT_FAILURE);
} }
if (isMultisamplingActive) { if (isMultisamplingActive) {
@ -332,6 +334,9 @@ void Viewer::displayGUI() {
// Display the FPS // Display the FPS
void Viewer::displayFPS() { void Viewer::displayFPS() {
std::string windowTitle = mWindowTitle + " | FPS : " + std::to_string(mFPS); std::stringstream ss;
ss << mFPS;
std::string fpsString = ss.str();
std::string windowTitle = mWindowTitle + " | FPS : " + fpsString;
glfwSetWindowTitle(mWindow, windowTitle.c_str()); glfwSetWindowTitle(mWindow, windowTitle.c_str());
} }

View File

@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 2.6)
PROJECT(Raycast) PROJECT(Raycast)
# Where to build the executables # Where to build the executables
SET(EXECUTABLE_OUTPUT_PATH "${OUR_EXECUTABLE_OUTPUT_PATH}/collisionshapes") SET(EXECUTABLE_OUTPUT_PATH "${OUR_EXECUTABLE_OUTPUT_PATH}/raycast")
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}) SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${EXECUTABLE_OUTPUT_PATH}) SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${EXECUTABLE_OUTPUT_PATH})
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${EXECUTABLE_OUTPUT_PATH}) SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${EXECUTABLE_OUTPUT_PATH})