diff --git a/emscripten/Makefile b/emscripten/Makefile index 5bdd7e766..86a94be06 100644 --- a/emscripten/Makefile +++ b/emscripten/Makefile @@ -1,5 +1,5 @@ all: - emcc -pthread -I../src/ ../src/*.c -DOPENGL=1 -s EXPORTED_RUNTIME_METHODS='["cwrap","getValue"]' -sSTACK_SIZE=655360 -s USE_GLFW=3 -s FULL_ES3=1 -Wl,--whole-archive -s LINKABLE=1 -o rebound.html + emcc -pthread -I../src/ ../src/*.c -DOPENGL=1 -s EXPORTED_RUNTIME_METHODS='["cwrap","getValue"]' -sSTACK_SIZE=655360 -s USE_GLFW=3 -s FULL_ES3=1 -Wl,--whole-archive -s LINKABLE=1 -sPTHREAD_POOL_SIZE=2 -o rebound.html serve: python serve.py diff --git a/src/display.c b/src/display.c index d5c8e64a1..ddbcfa046 100644 --- a/src/display.c +++ b/src/display.c @@ -176,7 +176,7 @@ static unsigned int linkProgram(int prog){ GLint logLength; glGetProgramiv(prog, GL_INFO_LOG_LENGTH, &logLength); - if (logLength > 0) { + if (logLength > 1) { // 0 should work - bug in emscripten? GLchar *log = (GLchar *)malloc(logLength); glGetProgramInfoLog(prog, logLength, &logLength, log); printf("\n\n%s\n\n",log); @@ -298,7 +298,6 @@ static void reb_display_cursor(GLFWwindow* window, double x, double y){ } static void reb_display_keyboard(GLFWwindow* window, int key, int scancode, int action, int mods){ - printf("keypress!\n"); struct reb_display_data* data = glfwGetWindowUserPointer(window); data->key_mods = mods; if (action==GLFW_PRESS){ diff --git a/src/rebound.c b/src/rebound.c index 09be632f8..d76746bf9 100644 --- a/src/rebound.c +++ b/src/rebound.c @@ -456,11 +456,8 @@ struct reb_simulation* reb_simulation_create(){ int main(void){ struct reb_simulation* r = reb_simulation_create(); - printf("Simulation init done\n"); reb_simulation_add_plummer(r, 100, 1.0, 1.0); - printf("Simulation plummer done\n"); reb_simulation_integrate(r,100); - printf("Simulation integrate done\n"); return 0; } #endif @@ -890,16 +887,16 @@ enum REB_STATUS reb_simulation_integrate(struct reb_simulation* const r, double reb_display_init_data(r); r->display_data->opengl_enabled = 1; - //pthread_t compute_thread; - //if (pthread_create(&compute_thread,NULL,reb_simulation_integrate_raw,&thread_info)){ - // reb_simulation_error(r, "Error creating display thread."); - //} + pthread_t compute_thread; + if (pthread_create(&compute_thread,NULL,reb_simulation_integrate_raw,&thread_info)){ + reb_simulation_error(r, "Error creating display thread."); + } reb_display_init(r); // Display routines running on main thread. - //if (pthread_join(compute_thread,NULL)){ - // reb_simulation_error(r, "Error joining display thread."); - // } + if (pthread_join(compute_thread,NULL)){ + reb_simulation_error(r, "Error joining display thread."); + } #else // OPENGL reb_simulation_error(r,"REBOUND was not compiled/linked with OPENGL libraries."); return REB_EXIT_ERROR;