int main(int argc, char **argv) { GLFWwindow *window; t_properties *properties; properties = get_properties(); properties->map = (argc > 1 ? argv[1] : NULL); window = setup_program(properties); properties->ires = glGetUniformLocation(properties->program, "iResolution"); properties->itime = glGetUniformLocation(properties->program, "iGlobalTime"); glfwSetCursorPosCallback(window, cursor_position_callback); glfwSetWindowSizeCallback(window, window_size_callback); main_loop(window, properties); ft_putnbr(glGetError()); ft_putendl(" 2"); glDeleteShader(properties->shaders[0]); glDeleteShader(properties->shaders[1]); glDeleteProgram(properties->program); glDeleteVertexArrays(1, &(properties->model)); glDeleteBuffers(1, &(properties->verts)); glDeleteBuffers(1, &(properties->indices)); glfwTerminate(); return (0); }
bool ExecutionManager::get_program() { std::string get_program_srv = get_private_param("program_acquisition_service"); ros::ServiceClient program_acquisition_client = node_handle.serviceClient<tangible_msgs::GetProgram>(get_program_srv); tangible_msgs::GetProgram program_srv; bool success = program_acquisition_client.call(program_srv); if(success) { ROS_INFO("program received"); if(program_srv.response.program.operations.empty()) { success = false; ROS_ERROR("Empty program received and discarded."); } else { setup_program(program_srv.response.program); current_operation_index = 0; } } else { ROS_ERROR("Failed to call service %s to obtain the compiled program.", get_program_srv.c_str()); } return success; }
int main(int argc, char *argv[]) { int ch, run_as_daemon = 1; const char *iface_ip = "127.0.0.1:5150"; while ((ch = getopt(argc, argv, "sDl:h")) != -1) switch (ch) { case 's': fprintf(stderr, "Warning: GRPC endpoint is already the default. " "Specifying this flag will soon be an error. (-s)\n"); break; case 'D': run_as_daemon = 0; break; case 'l': iface_ip = optarg; break; case 'h': default: fprintf(stderr, "Usage: %s [-D] [-l interface_ip:port]\n", argv[0]); exit(EXIT_FAILURE); } if (run_as_daemon) if (daemon(1, 1) < 0) { perror("daemon"); exit(EXIT_FAILURE); } setup_program(); signal(SIGPIPE, SIG_IGN); char *ipport = strdup(iface_ip); char *ip = strtok(ipport, ":"); char *port = strtok(NULL, ":"); start_grpc_server(ip, atoi(port)); free(ipport); return 0; }
static int setup_so (SceneData* sceneData, SceneObject* so) { SoData* soData = malloc(sizeof(SoData)); soData->attributes = list_alloc(); soData->textures = list_alloc(); GLuint programHandle; if ( -1 == setup_program( sceneData, so, soData, &programHandle ) ) return -1; if ( -1 == setup_attributes( sceneData, so, soData, programHandle ) ) return -1; if ( -1 == setup_textures ( sceneData, so, soData, programHandle ) ) return -1; if ( -1 == setup_index_buffer ( sceneData, so, soData ) ) return -1; char soKey[KEYSIZE]; snprintf ( soKey, KEYSIZE, "%p", so ); hashmap_insert ( soKey, soData, sceneData->mapSo2SoData ); return 0; }