Fix issues on Mac OS X
This commit is contained in:
parent
7ca5b88ce3
commit
76deef4358
|
@ -7,9 +7,6 @@ PROJECT(REACTPHYSICS3D)
|
||||||
# Where to build the library
|
# Where to build the library
|
||||||
SET(LIBRARY_OUTPUT_PATH lib/)
|
SET(LIBRARY_OUTPUT_PATH lib/)
|
||||||
|
|
||||||
# Where to build the executables
|
|
||||||
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
|
||||||
|
|
||||||
# Options
|
# Options
|
||||||
OPTION(COMPILE_EXAMPLES "Select this if you want to build the examples" OFF)
|
OPTION(COMPILE_EXAMPLES "Select this if you want to build the examples" OFF)
|
||||||
OPTION(COMPILE_TESTS "Select this if you want to build the tests" OFF)
|
OPTION(COMPILE_TESTS "Select this if you want to build the tests" OFF)
|
||||||
|
|
|
@ -4,11 +4,14 @@ cmake_minimum_required(VERSION 2.6)
|
||||||
# Project configuration
|
# Project configuration
|
||||||
PROJECT(CollisionShapes)
|
PROJECT(CollisionShapes)
|
||||||
|
|
||||||
|
# Where to build the executable
|
||||||
|
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin/collisionshapes/)
|
||||||
|
|
||||||
# Copy the shaders used for the demo into the build directory
|
# Copy the shaders used for the demo into the build directory
|
||||||
FILE(COPY "../common/opengl-framework/src/shaders/" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/shaders/")
|
FILE(COPY "../common/opengl-framework/src/shaders/" DESTINATION "${EXECUTABLE_OUTPUT_PATH}/shaders/")
|
||||||
|
|
||||||
# Copy the meshes used for the demo into the build directory
|
# Copy the meshes used for the demo into the build directory
|
||||||
FILE(COPY "../common/meshes/" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/meshes/")
|
FILE(COPY "../common/meshes/" DESTINATION "${EXECUTABLE_OUTPUT_PATH}/meshes/")
|
||||||
|
|
||||||
# Headers
|
# Headers
|
||||||
INCLUDE_DIRECTORIES("../common/opengl-framework/src/" "../common/")
|
INCLUDE_DIRECTORIES("../common/opengl-framework/src/" "../common/")
|
||||||
|
|
|
@ -67,7 +67,11 @@ int main(int argc, char** argv) {
|
||||||
glutMouseFunc(mouseButton);
|
glutMouseFunc(mouseButton);
|
||||||
glutMotionFunc(mouseMotion);
|
glutMotionFunc(mouseMotion);
|
||||||
glutKeyboardFunc(keyboard);
|
glutKeyboardFunc(keyboard);
|
||||||
|
#ifdef USE_FREEGLUT
|
||||||
glutCloseFunc(finish);
|
glutCloseFunc(finish);
|
||||||
|
#else
|
||||||
|
atexit(finish);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Glut main looop
|
// Glut main looop
|
||||||
glutMainLoop();
|
glutMainLoop();
|
||||||
|
@ -115,7 +119,10 @@ void keyboard(unsigned char key, int x, int y) {
|
||||||
|
|
||||||
// Escape key
|
// Escape key
|
||||||
case 27:
|
case 27:
|
||||||
|
#ifdef USE_FREEGLUT
|
||||||
|
// TODO : Check if we need to call finish() here
|
||||||
glutLeaveMainLoop();
|
glutLeaveMainLoop();
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Space bar
|
// Space bar
|
||||||
|
|
|
@ -68,6 +68,7 @@ void Viewer::displayGUI() {
|
||||||
// Display the FPS
|
// Display the FPS
|
||||||
void Viewer::displayFPS() {
|
void Viewer::displayFPS() {
|
||||||
|
|
||||||
|
#ifdef USE_FREEGLUT
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
glOrtho(0, mCamera.getWidth(), mCamera.getHeight(), 0, -1, 1);
|
glOrtho(0, mCamera.getWidth(), mCamera.getHeight(), 0, -1, 1);
|
||||||
|
@ -80,4 +81,5 @@ void Viewer::displayFPS() {
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << "FPS : " << fps;
|
ss << "FPS : " << fps;
|
||||||
glutBitmapString(GLUT_BITMAP_HELVETICA_12, (const unsigned char*)ss.str().c_str());
|
glutBitmapString(GLUT_BITMAP_HELVETICA_12, (const unsigned char*)ss.str().c_str());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,11 @@
|
||||||
#include "maths/Vector2.h"
|
#include "maths/Vector2.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
|
#ifdef __APPLE__
|
||||||
|
#include "GLUT/glut.h"
|
||||||
|
#else
|
||||||
#include "GL/freeglut.h"
|
#include "GL/freeglut.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace openglframework {
|
namespace openglframework {
|
||||||
|
|
||||||
|
|
|
@ -41,8 +41,7 @@ varying vec2 texCoords; // Texture coordinates
|
||||||
void main() {
|
void main() {
|
||||||
|
|
||||||
// Compute the ambient term
|
// Compute the ambient term
|
||||||
//vec3 ambient = lightAmbientColor;
|
vec3 ambient = lightAmbientColor;
|
||||||
vec3 ambient = vertexColor.rgb + 0.0 * lightAmbientColor;
|
|
||||||
|
|
||||||
// Get the texture color
|
// Get the texture color
|
||||||
vec3 textureColor = vertexColor.rgb;
|
vec3 textureColor = vertexColor.rgb;
|
||||||
|
@ -59,8 +58,8 @@ void main() {
|
||||||
// Compute the specular term of light 0
|
// Compute the specular term of light 0
|
||||||
vec3 V = normalize(-vertexPosCameraSpace);
|
vec3 V = normalize(-vertexPosCameraSpace);
|
||||||
vec3 H0 = normalize(V + L0);
|
vec3 H0 = normalize(V + L0);
|
||||||
float specularFactor = pow(max(dot(N, H0), 0), shininess);
|
float specularFactor = pow(max(dot(N, H0), 0.0), shininess);
|
||||||
if (diffuseFactor < 0) specularFactor = 0.0;
|
if (diffuseFactor < 0.0) specularFactor = 0.0;
|
||||||
vec3 specular = light0SpecularColor * specularFactor;
|
vec3 specular = light0SpecularColor * specularFactor;
|
||||||
|
|
||||||
// Compute the final color
|
// Compute the final color
|
||||||
|
|
|
@ -4,8 +4,11 @@ cmake_minimum_required(VERSION 2.6)
|
||||||
# Project configuration
|
# Project configuration
|
||||||
PROJECT(Cubes)
|
PROJECT(Cubes)
|
||||||
|
|
||||||
|
# Where to build the executable
|
||||||
|
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin/cubes/)
|
||||||
|
|
||||||
# Copy the shaders used for the demo into the build directory
|
# Copy the shaders used for the demo into the build directory
|
||||||
FILE(COPY "../common/opengl-framework/src/shaders/" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/shaders/")
|
FILE(COPY "../common/opengl-framework/src/shaders/" DESTINATION "${EXECUTABLE_OUTPUT_PATH}/shaders/")
|
||||||
|
|
||||||
# Headers
|
# Headers
|
||||||
INCLUDE_DIRECTORIES("../common/opengl-framework/src/" "../common/")
|
INCLUDE_DIRECTORIES("../common/opengl-framework/src/" "../common/")
|
||||||
|
|
|
@ -66,7 +66,12 @@ int main(int argc, char** argv) {
|
||||||
glutMouseFunc(mouseButton);
|
glutMouseFunc(mouseButton);
|
||||||
glutMotionFunc(mouseMotion);
|
glutMotionFunc(mouseMotion);
|
||||||
glutKeyboardFunc(keyboard);
|
glutKeyboardFunc(keyboard);
|
||||||
|
|
||||||
|
#ifdef USE_FREEGLUT
|
||||||
glutCloseFunc(finish);
|
glutCloseFunc(finish);
|
||||||
|
#else
|
||||||
|
atexit(finish);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Glut main looop
|
// Glut main looop
|
||||||
glutMainLoop();
|
glutMainLoop();
|
||||||
|
@ -114,7 +119,10 @@ void keyboard(unsigned char key, int x, int y) {
|
||||||
|
|
||||||
// Escape key
|
// Escape key
|
||||||
case 27:
|
case 27:
|
||||||
|
#ifdef USE_FREEGLUT
|
||||||
|
// TODO : Check if we need to call finish() here
|
||||||
glutLeaveMainLoop();
|
glutLeaveMainLoop();
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Space bar
|
// Space bar
|
||||||
|
|
|
@ -4,8 +4,11 @@ cmake_minimum_required(VERSION 2.6)
|
||||||
# Project configuration
|
# Project configuration
|
||||||
PROJECT(Joints)
|
PROJECT(Joints)
|
||||||
|
|
||||||
|
# Where to build the executable
|
||||||
|
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin/joints/)
|
||||||
|
|
||||||
# Copy the shaders used for the demo into the build directory
|
# Copy the shaders used for the demo into the build directory
|
||||||
FILE(COPY "../common/opengl-framework/src/shaders/" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/shaders/")
|
FILE(COPY "../common/opengl-framework/src/shaders/" DESTINATION "${EXECUTABLE_OUTPUT_PATH}/shaders/")
|
||||||
|
|
||||||
# Headers
|
# Headers
|
||||||
INCLUDE_DIRECTORIES("../common/opengl-framework/src/" "../common/")
|
INCLUDE_DIRECTORIES("../common/opengl-framework/src/" "../common/")
|
||||||
|
|
|
@ -66,7 +66,11 @@ int main(int argc, char** argv) {
|
||||||
glutMouseFunc(mouseButton);
|
glutMouseFunc(mouseButton);
|
||||||
glutMotionFunc(mouseMotion);
|
glutMotionFunc(mouseMotion);
|
||||||
glutKeyboardFunc(keyboard);
|
glutKeyboardFunc(keyboard);
|
||||||
|
#ifdef USE_FREEGLUT
|
||||||
glutCloseFunc(finish);
|
glutCloseFunc(finish);
|
||||||
|
#else
|
||||||
|
atexit(finish);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Glut main looop
|
// Glut main looop
|
||||||
glutMainLoop();
|
glutMainLoop();
|
||||||
|
@ -114,7 +118,10 @@ void keyboard(unsigned char key, int x, int y) {
|
||||||
|
|
||||||
// Escape key
|
// Escape key
|
||||||
case 27:
|
case 27:
|
||||||
|
#ifdef USE_FREEGLUT
|
||||||
|
// TODO : Check if we need to call finish() here
|
||||||
glutLeaveMainLoop();
|
glutLeaveMainLoop();
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Space bar
|
// Space bar
|
||||||
|
|
Loading…
Reference in New Issue
Block a user