src/OpenCVGUI/OGUI3D.cpp
// Read a shader source from a file
// store the shader source in a std::vector<char>
Read a shader source from a file
store the shader source in a std::vector
Read a shader source from a file store the shader source in a std :: vector
void read_shader_src(const char *fname, std::vector<char> &buffer) {
        std::ifstream in;
        in.open(fname, std::ios::binary);
        if(in.is_open()) {
            in.seekg(0, std::ios::end);
            size_t length = (size_t)in.tellg();
            in.seekg(0, std::ios::beg);
            buffer.resize(length + 1);
            in.read(&buffer[0], length);
            in.close();
            buffer[length] = '\0';
        }
        else {
            std::cerr << "Unable to open " << fname << " I'm out!" << std::endl;
            exit(-1);
        }
    }
void read_shader_src ( const char * fname , std :: vector < char > & buffer ) { std :: ifstream in ; in . open ( fname , std :: ios :: binary ) ; if ( in . is_open ( ) ) { in . seekg ( 0 , std :: ios :: end ) ; size_t length = ( size_t ) in . tellg ( ) ; in . seekg ( 0 , std :: ios :: beg ) ; buffer . resize ( length + 1 ) ; in . read ( & buffer [ 0 ] , length ) ; in . close ( ) ; buffer [ length ] = ' \0 ' ; } else { std :: cerr << " " << fname << " " << std :: endl ; exit ( -1 ) ; } }
Read a shader source from a file
store the shader source in a std::vector<char>
Read a shader source from a file store the shader source in a std :: vector<char >
// Get the number of bytes stored in this file // Go to start of the file // Read the content of the file in a buffer // Add a valid C - string end