bool shaderProgram::loadProgramFromResource(const char *VERTEX_ID, const char *FRAGMENT_ID) { std::string vertexSource = loadStringFromResource(VERTEX_ID); if (vertexSource.empty()) return false; std::string fragmentSource = loadStringFromResource(FRAGMENT_ID); if (fragmentSource.empty()) return false; return loadProgramFromSource(vertexSource.c_str(), fragmentSource.c_str()); }
bool shaderProgram::loadProgramFromFile(const char *vertexFilename, const char *fragmentFilename) { std::string vertexSource = loadStringFromFile(vertexFilename); if (vertexSource.empty()) return false; std::string fragmentSource = loadStringFromFile(fragmentFilename); if (fragmentSource.empty()) return false; return loadProgramFromSource(vertexSource.c_str(), fragmentSource.c_str()); }
int opencl_create_program(char* program_path) { char* program_source; int size; size_t prog_size; cl_int err; program_source = loadProgramFromSource(program_path, &size); prog_size = (size_t)size; program = clCreateProgramWithSource(context, 1, (const char**)&program_source, &prog_size, &err); if ( err != CL_SUCCESS ) printf("Erro = %d\n",err); return buildProgram(); }