示例#1
0
cl::Program KernelLoader::loadProgram(
        const std::string &sourcePath,
        const cl::Context &context,
        const std::string &buildOptions)
{
    std::ifstream sourceStream(sourcePath);
    if (sourceStream.fail()) {
        throw std::ifstream::failure("unable to open file");
    }
    sourceStream.exceptions(std::ifstream::failbit | std::ifstream::badbit);

    std::string sourceText {
        std::istreambuf_iterator<char>(sourceStream),
        std::istreambuf_iterator<char>()
    };

    cl::Program prog(context, sourceText);
    try {
        prog.build(buildOptions.c_str());
    } catch (const cl::Error &err) {
        std::cerr << "ERROR: Failed to build program!" << std::endl;
        for (cl::Device &device : context.getInfo<CL_CONTEXT_DEVICES>()) {
            std::string buildLog = prog.getBuildInfo<CL_PROGRAM_BUILD_LOG>(device);
            if (!buildLog.empty()) {
                std::cerr << "INFO: Build log from device '" << device.getInfo<CL_DEVICE_NAME>() << "':" << std::endl;
                std::cerr << buildLog << std::endl;
            }
        }
        throw;
    }
    return prog;
}
示例#2
0
void QProtobufModel::checkSourceChange()
{
    if (m_metadata.isEmpty())
        return;

    if (m_message.isEmpty())
        return;

    if (m_source.isEmpty())
        return;

    QProtobufModelErrorCollector errorCollector(this);
    QProtobufModelSourceTree sourceTree(m_metadata, this);

    ::pb::compiler::Importer importer(&sourceTree, &errorCollector);

    auto fileDescriptor = importer.Import(m_metadata.toString().toStdString());

    auto descriptor = fileDescriptor->FindMessageTypeByName(m_message.toStdString());

    m_prototype = m_messageFactory.GetPrototype(descriptor);

    m_rootItem = m_prototype->New();

    LocalFileStream sourceStream(m_source);

    m_rootItem->ParseFromZeroCopyStream(&sourceStream);
}
	void FileSystem::copyFile(const Path& source, const Path& destination)
	{
		std::ifstream sourceStream(source.toString().c_str(), std::ios::binary);
		std::ofstream destinationStream(destination.toString().c_str(), std::ios::binary);

		destinationStream << sourceStream.rdbuf();
		sourceStream.close();
		destinationStream.close();
	}
示例#4
0
bool SkCLImageDiffer::loadKernelFile(const char file[], const char name[], cl_kernel* kernel) {
    // Open the kernel source file
    SkFILEStream sourceStream(file);
    if (!sourceStream.isValid()) {
        SkDebugf("Failed to open kernel source file");
        return false;
    }

    return loadKernelStream(&sourceStream, name, kernel);
}
	void ShaderFile::_parseShader(std::string& shader, std::vector<std::string> includeList)
	{
		// Copy source
		std::string source = shader;
		shader.clear();

		std::stringstream sourceStream(source);
		std::string line, token;

		while (!sourceStream.eof())
		{
			std::getline(sourceStream, line, '\n');
			std::stringstream lineStream(line);
			std::getline(lineStream, token, ' ');
			
			if (token == "#include")
			{
				std::getline(lineStream, token, '"');
				std::getline(lineStream, token, '"');

				if (!token.empty())
				{
					bool found = false;
					for (auto iter : includeList)
					{
						if (iter == token)
							found = true;
					}

					if (!found)
					{
						includeList.push_back(token);

						std::string incldeFile;
						if (!Utilities::fileToString(mDirectory + token, incldeFile))
							Log::error("Cannot include file '%s' in '%s'", token.c_str(), (mDirectory + mFileName).c_str());
						else
						{
							_parseShader(incldeFile, includeList);
							shader += incldeFile;
						}
					}
				}
			}
			else
			{
				shader += line + '\n';
			}
		}


	}
// FOR NOW THIS HAS THE FOLLOWING LIMITATIONS:
//		- Blocks can only be lighting related (easily fixable) << Quickly
//		- There's no explicit support to arrays.
// FIX ASAP
void ShaderProgram::fillUniformTable(){
	for(unsigned int i=0; i<m_shaders.size(); i++){
		std::string currSource = m_shaders.at(i).getSource();
		std::string line,s, type;
		std::istringstream sourceStream(currSource);
		while(std::getline(sourceStream,line)){
			std::istringstream iss(line);
			iss >> s;
			if(s=="layout(std140)"){
				iss >> s;	// skip keyword "uniform"
				iss >> s;
				m_lightUBO = glGetUniformBlockIndex(m_ID, s.c_str());
				glUniformBlockBinding(m_ID, m_lightUBO, LIGHT_UBO_BINDING_POINT);
			} else if(s=="uniform"){
				iss >> type; // skip type
				iss >> s;
				s = s.substr(0, s.size()-1); // Remove ;
				addUniform(s);	
			}
ShaderProgram::Shader* ResourceManager::LoadShaderSource(std::string path)
{
	ShaderProgram::Shader* shader = shaderMap[path];

	if (shader == nullptr)
	{
		shader = new ShaderProgram::Shader();

		shader->path = path;

		std::string extension = path.substr(path.find_last_of('.') + 1);

		if (extension == ShaderProgram::VERT_EXTENSION)
		{
			shader->type = GL_VERTEX_SHADER;
		}
		else if (extension == ShaderProgram::FRAG_EXTENSION)
		{
			shader->type = GL_FRAGMENT_SHADER;
		}
		else if (extension == ShaderProgram::GEOM_EXTENSION)
		{
			shader->type = GL_GEOMETRY_SHADER;
		}

		std::ifstream sourceStream(path, std::ios::ate | std::ios::binary);

		size_t size = sourceStream.tellg();
		shader->source = new GLchar[size + 1];
		sourceStream.seekg(0);
		sourceStream.read(shader->source, size);
		shader->source[size] = '\0';

		shaderMap[path] = shader;
	}

	return shader;
}
void DataInterface::writeEdgeList(
		   const QString sourceSelection, const QString targetSelection, const bool directedRelationships,
		   const QString relationsType, const std::string filename, const std::string sepOne, const std::string sepTwo
		   ) {
  // We point to the InputTable and we get all the stuff out that we need from the input table and the function arguments.
  std::string sourceString = sourceSelection.toStdString();
  std::string targetString = targetSelection.toStdString();
  std::string relationshipType = "Undirected";
  if (directedRelationships) {
    relationshipType = "Directed";
  }
  std::string relationshipLabel = relationsType.toStdString();
  std::istringstream convertSepOne(sepOne.c_str());
  char sepOneChar;
  convertSepOne >> sepOneChar;
  std::istringstream convertSepTwo(sepTwo.c_str());
  char sepTwoChar;
  convertSepTwo >> sepTwoChar;
    
  // We need to know in which part of the data vector the source and target node reside.
  // We create and set an index to achieve that.
  int sourceIndex = 0;
  int targetIndex = 0;
  for (std::vector<std::string>::size_type i = 0; i != header.size(); i++) {
    std::string currentString = header[i];
    if (currentString == sourceString) {
      sourceIndex = i;
    }
    if (currentString == targetString) {
      targetIndex = i;
    }
  }

  // Then we prepare the file for writing.
  std::ofstream fileOut(filename.c_str());
  if (!fileOut.is_open()) {
    QPointer<QMessageBox> errorBox = new QMessageBox;
    errorBox->setText(tr("<b>ERROR: Could not write file</b>"));
    errorBox->setInformativeText("The program had problems trying to open the file in which to write data");
    errorBox->exec();
    return;
  }
  
  // First we write the header of the file.
  if (relationshipLabel.length() > 0) {
    fileOut << "Source" << sepOne << "Target" << sepOne << "Weight" << sepOne << "Type" << sepOne << "Type_User_Defined";
  } else {
    fileOut << "Source" << sepOne << "Target" << sepOne << "Weight" << sepOne << "Type";
  }
  fileOut << '\n';

  // We make a vector to store our lines for the output file.
  std::vector <std::string> fileVector;
  
  // Then we iterate through the data vector, find the appropriate entries, and write them to our file vector.
  std::vector <std::vector <std::string> >::iterator itData;
  for (itData = rowData.begin(); itData != rowData.end(); itData++) {
    std::vector <std::string> currentData = *itData;
    std::string currentSource = currentData[sourceIndex];
    std::string currentTarget = currentData[targetIndex];
    std::vector <std::string> sepSources;
    std::vector <std::string> sepTargets;

    // Some of the entries may have multiple values in one string. We need to separate these now.
    std::istringstream sourceStream(currentSource);
    while (sourceStream) {
      std::string s;
      if (!getline(sourceStream, s, sepTwoChar)) break;
      while (s[0] == ' ') {
	s = s.substr(1, s.length());
      }
      sepSources.push_back(s);
    }
    std::istringstream targetStream(currentTarget);
    while (targetStream) {
      std::string s;
      if (!getline(targetStream, s, sepTwoChar)) break;
      while (s[0] == ' ') {
	s = s.substr(1, s.length());
      }
      sepTargets.push_back(s);
    }
    std::vector <std::string>::iterator itSepSources;
    std::vector <std::string>::iterator itSepTargets;

    // After making sures that the values have been separated where necessary, we can write the bulk of our file.
    for (itSepSources = sepSources.begin(); itSepSources != sepSources.end(); itSepSources++) {
      std::string currentSepSource = *itSepSources;
      for (itSepTargets = sepTargets.begin(); itSepTargets != sepTargets.end(); itSepTargets++) {
	std::string currentSepTarget = *itSepTargets;
	if (currentSepSource != currentSepTarget) {
	  std::vector <std::string> tempVector;
	  tempVector.push_back(currentSepSource);
	  tempVector.push_back(currentSepTarget);
	  if (sourceSelection == targetSelection) {
	    std::sort(tempVector.begin(), tempVector.end());
	  }
	  std::string sourceTarget = tempVector[0] + sepOne + tempVector[1];
	  if (relationshipLabel.size() > 0) {
	    fileVector.push_back(sourceTarget + sepOne + "1" + sepOne + relationshipType + sepOne +  relationshipLabel + '\n');
	  } else {
	    fileVector.push_back(sourceTarget + sepOne + "1" + sepOne + relationshipType + '\n');
	  }
	}
      }
    }
  }
  if (fileVector.empty()) {
    QPointer<QMessageBox> errorBox =  new QMessageBox;
    errorBox->setText("<b>WARNING</b>");
    errorBox->setInformativeText("The Edge list is empty. Check your settings.");
    errorBox->exec();
  }
  // We remove all doubles from the edge list here.
  std::sort(fileVector.begin(), fileVector.end());
  fileVector.erase(std::unique(fileVector.begin(), fileVector.end()), fileVector.end());

  // Then we iterate through our file vector and write everything to our file.
  std::vector <std::string>::iterator lineReader;
  for (lineReader = fileVector.begin(); lineReader != fileVector.end(); lineReader++) {
    fileOut << *lineReader;
  }
  
  // And after that we can close the file and end the function.
  fileOut.close();
  return;
}
示例#9
0
QMimeData* toResultModel::mimeData(const QModelIndexList &indexes) const
{
    QMimeData   *mimeData = new QMimeData();
    QByteArray   encodedData;
    QDataStream  stream(&encodedData, QIODevice::WriteOnly);
    QByteArray   stringData;
    QDataStream  ss(&stringData, QIODevice::WriteOnly);

    int         valid = 0;
    QModelIndex validIndex;
    QString     text;

    // qt sends list by column (all indexes from column 1, then column
    // column2). Need to figure out the number of columns and
    // rows. It'd be awesome if we could get the selection but there's
    // no good way to do that from the model.
    int rows       = 0;
    int columns    = 0;
    int currentRow = -1;
    int currentCol = -1;

    foreach (QModelIndex index, indexes)
    {
        if (index.isValid())
        {
            if (index.row() > currentRow)
            {
                currentRow = index.row();
                rows++;
            }

            if (currentCol != index.column())
            {
                currentCol = index.column();
                columns++;
            }

            valid++;
            validIndex = index;
            text = data(index, Qt::DisplayRole).toString();
            ss << text;
        }
    }

    if (valid < 1)
        return 0;

    if (valid == 1)
    {
        mimeData->setText(text);

        // set row and column in data so we can try to preserve the
        // columns, if needed

        QByteArray sourceData;
        QDataStream sourceStream(&sourceData, QIODevice::WriteOnly);
        sourceStream << validIndex.row();
        sourceStream << validIndex.column();
        mimeData->setData("application/vnd.int.list", sourceData);
    }
    else
    {
        // serialize selection shape
        stream << rows;
        stream << columns;
        mimeData->setData("application/vnd.tomodel.list", encodedData + stringData);
    }

    return mimeData;
}
示例#10
0
void TestRunner::compile()
{
    // Check when is the last time that the test source has been modified
    const QString filePath = inDir_.filePath(fileName_);
    const QFileInfo fileInfo(filePath);
    const QDateTime lastModified = fileInfo.lastModified();

    // Compile if necessary
    Status s = status();
    bool notCompiledYet = (s == Status::NotCompiledYet) || (s == Status::CompileError);
    bool modified       = (lastCompiled_ < lastModified);
    bool processing     = (s == Status::Compiling) || (s == Status::Running);
    if (notCompiledYet || (modified && !processing))
    {
         setStatus_(Status::Compiling);
        compileOutput_.clear();
        lastCompiled_ = lastModified;

        // -------- Go to folder where to compile test --------

        QString compileDirPath = outDir_.absoluteFilePath(testName_);
        compileDir_ = outDir_;
        if (!compileDir_.cd(testName_))
        {
            // Create folder since it doesn't exist
            if (!outDir_.mkdir(testName_))
            {
                failCompilation_("Can't create build folder " + compileDirPath);
                return;
            }

            // Go to folder where to compile test
            // This is hard to reach (if we manage to create the folder, surely
            // we can cd to it), but doesn't hurt to check.
            if (!compileDir_.cd(testName_))
            {
                failCompilation_("Can't create build folder " + compileDirPath);
                return;
            }
        }


        // -------- Open all files for reading or writing --------

        const QString hFileName   = testName_ + ".gen.h";
        const QString cppFileName = testName_ + ".gen.cpp";
        const QString proFileName = testName_ + ".gen.pro";

        const QString hFilePath   = compileDir_.filePath(hFileName);
        const QString cppFilePath = compileDir_.filePath(cppFileName);
        const QString proFilePath = compileDir_.filePath(proFileName);

        QFile sourceFile(filePath);
        QFile hFile(hFilePath);
        QFile cppFile(cppFilePath);
        QFile proFile(proFilePath);

        if (!sourceFile.open(QFile::ReadOnly | QFile::Text))
        {
            failCompilation_("Can't open " + filePath);
            return;
        }

        if (!hFile.open(QFile::WriteOnly | QFile::Text))
        {
            failCompilation_("Can't write " + hFilePath);
            return;
        }

        if (!cppFile.open(QFile::WriteOnly | QFile::Text))
        {
            failCompilation_("Can't write " + cppFilePath);
            return;
        }

        if (!proFile.open(QFile::WriteOnly | QFile::Text))
        {
            failCompilation_("Can't write " + proFilePath);
            return;
        }


        // -------- Read source file --------

        QTextStream sourceStream(&sourceFile);
        const QString testSource = sourceStream.readAll();


        // -------- Generate and write test gen files --------

        QTextStream hStream(&hFile);
        QTextStream cppStream(&cppFile);
        QTextStream proStream(&proFile);

        hStream   << generateH(testName_, testSource);
        cppStream << generateCpp(testName_, testSource);
        proStream << generatePro(testName_, testSource);


        // -------- Run qmake --------

        QString program = QMAKE_QMAKE_QMAKE;
        QStringList arguments;
        arguments << "-spec" << QMAKE_QMAKESPEC << proFilePath;

        compileOutput_ +=
                getCurrentTime() +
                ": Starting: \"" +
                program + "\" " +
                arguments.join(' ') + "\n";

        process_->setWorkingDirectory(compileDirPath);
        connect(process_,
                static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&QProcess::finished),
                this,
                &TestRunner::compile_onQmakeFinished_);

        emit outputChanged();

        process_->start(program, arguments);

        // -> go read qMakeFinished_(int exitCode) now.
    }
    else
    {
        emit compileFinished(true);
    }
}
示例#11
0
int ExtractGHKM::Main(int argc, char *argv[])
{
  // Process command-line options.
  Options options;
  ProcessOptions(argc, argv, options);

  // Open input files.
  InputFileStream targetStream(options.targetFile);
  InputFileStream sourceStream(options.sourceFile);
  InputFileStream alignmentStream(options.alignmentFile);

  // Open output files.
  OutputFileStream fwdExtractStream;
  OutputFileStream invExtractStream;
  std::ofstream glueGrammarStream;
  std::ofstream unknownWordStream;
  std::string fwdFileName = options.extractFile;
  std::string invFileName = options.extractFile + std::string(".inv");
  if (options.gzOutput) {
    fwdFileName += ".gz";
    invFileName += ".gz";
  }
  OpenOutputFileOrDie(fwdFileName, fwdExtractStream);
  OpenOutputFileOrDie(invFileName, invExtractStream);
  if (!options.glueGrammarFile.empty()) {
    OpenOutputFileOrDie(options.glueGrammarFile, glueGrammarStream);
  }
  if (!options.unknownWordFile.empty()) {
    OpenOutputFileOrDie(options.unknownWordFile, unknownWordStream);
  }

  // Target label sets for producing glue grammar.
  std::set<std::string> labelSet;
  std::map<std::string, int> topLabelSet;

  // Word count statistics for producing unknown word labels.
  std::map<std::string, int> wordCount;
  std::map<std::string, std::string> wordLabel;

  std::string targetLine;
  std::string sourceLine;
  std::string alignmentLine;
  XmlTreeParser xmlTreeParser(labelSet, topLabelSet);
  ScfgRuleWriter writer(fwdExtractStream, invExtractStream, options);
  size_t lineNum = options.sentenceOffset;
  while (true) {
    std::getline(targetStream, targetLine);
    std::getline(sourceStream, sourceLine);
    std::getline(alignmentStream, alignmentLine);

    if (targetStream.eof() && sourceStream.eof() && alignmentStream.eof()) {
      break;
    }

    if (targetStream.eof() || sourceStream.eof() || alignmentStream.eof()) {
      Error("Files must contain same number of lines");
    }

    ++lineNum;

    // Parse target tree.
    if (targetLine.size() == 0) {
      std::cerr << "skipping line " << lineNum << " with empty target tree\n";
      continue;
    }
    std::auto_ptr<ParseTree> t;
    try {
      t = xmlTreeParser.Parse(targetLine);
      assert(t.get());
    } catch (const Exception &e) {
      std::ostringstream s;
      s << "Failed to parse XML tree at line " << lineNum;
      if (!e.GetMsg().empty()) {
        s << ": " << e.GetMsg();
      }
      Error(s.str());
    }

    // Read source tokens.
    std::vector<std::string> sourceTokens(ReadTokens(sourceLine));

    // Read word alignments.
    Alignment alignment;
    try {
      alignment = ReadAlignment(alignmentLine);
    } catch (const Exception &e) {
      std::ostringstream s;
      s << "Failed to read alignment at line " << lineNum << ": ";
      s << e.GetMsg();
      Error(s.str());
    }
    if (alignment.size() == 0) {
      std::cerr << "skipping line " << lineNum << " without alignment points\n";
      continue;
    }

    // Record word counts.
    if (!options.unknownWordFile.empty()) {
      CollectWordLabelCounts(*t, options, wordCount, wordLabel);
    }

    // Form an alignment graph from the target tree, source words, and
    // alignment.
    AlignmentGraph graph(t.get(), sourceTokens, alignment);

    // Extract minimal rules, adding each rule to its root node's rule set.
    graph.ExtractMinimalRules(options);

    // Extract composed rules.
    if (!options.minimal) {
      graph.ExtractComposedRules(options);
    }

    // Write the rules, subject to scope pruning.
    const std::vector<Node *> &targetNodes = graph.GetTargetNodes();
    for (std::vector<Node *>::const_iterator p = targetNodes.begin();
         p != targetNodes.end(); ++p) {
      const std::vector<const Subgraph *> &rules = (*p)->GetRules();
      for (std::vector<const Subgraph *>::const_iterator q = rules.begin();
           q != rules.end(); ++q) {
        ScfgRule r(**q);
        // TODO Can scope pruning be done earlier?
        if (r.Scope() <= options.maxScope) {
          writer.Write(r);
        }
      }
    }
  }

  if (!options.glueGrammarFile.empty()) {
    WriteGlueGrammar(labelSet, topLabelSet, glueGrammarStream);
  }

  if (!options.unknownWordFile.empty()) {
    WriteUnknownWordLabel(wordCount, wordLabel, options, unknownWordStream);
  }

  return 0;
}
示例#12
0
文件: cbir.cpp 项目: chiiph/keepc
int CBIR::buildClustersIndex(){
    if(clustersMat.data == NULL)
        exit(1);

    //Creo el índice.
//    cv::flann::KDTreeIndexParams kdtiParams(1);
//    cv::Mat savedIndexMat(1, 1, CV_32F);
//    cv::flann::Index clustersIndex = cv::flann::Index(savedIndexMat, kdtiParams);
    cv::flann::Index *clustersIndex;
    qDebug() << "Declaro el indice.";

    QFile indexFile("cbir\\flann\\index\\index.hdf5");
    if(indexFile.exists()){
        cv::flann::SavedIndexParams siParams("cbir\\flann\\index\\index.hdf5");
        clustersIndex = new cv::flann::Index(clustersMat, siParams);
        qDebug() << "Creo el indice a partir del archivo.";
    }else{
        cv::flann::KDTreeIndexParams kdtiParams(8);
        clustersIndex = new cv::flann::Index(clustersMat, kdtiParams);
        clustersIndex->save("cbir\\flann\\index\\index.hdf5");
        qDebug() << "Creo el indice a partir de la matriz.";
    }

    cv::Mat indices(descriptorsMat.rows, 1, CV_32S);
    cv::Mat dists(descriptorsMat.rows, 1, CV_32F);
    //cv::Mat_<float> indices(descriptorsMat.rows, 1);
    //cv::Mat_<int> dists(descriptorsMat.rows, 1);

    //Ubica cada feature en un determinado cluster basándose en Knn-Search
    clustersIndex->knnSearch(descriptorsMat, indices, dists, 1, cv::flann::SearchParams(1024));
    qDebug() << endl << "Indices:" << indices.rows << endl;

    //DOCUMENTO    
    int totalFeatures = 0;
    QFile sourceFile("cbir/lemur/index/index_source");
    sourceFile.open(QIODevice::WriteOnly | QIODevice::Text);
    QTextStream sourceStream(&sourceFile);
    QFile trecFile;
    QTextStream trecStream(&trecFile);

    //Itero sobre las imágenes.
    for(int i=0; i<featuresCount.count() && totalFeatures < descriptorsMat.rows; i++){
        trecFile.setFileName("cbir/lemur/files/" + featuresCount[i].first + ".trec");
        if (!trecFile.open(QIODevice::WriteOnly | QIODevice::Text))
            return 1;
        trecStream.flush();

        trecStream << "<DOC>" << endl
                << "<DOCNO>" << featuresCount[i].first << "</DOCNO>" << endl
                << "<TEXT>" << endl;

        // Itero sobre todos los features de la imagen.
        for(int j=0; j<featuresCount[i].second && totalFeatures < descriptorsMat.rows; j++, totalFeatures++){
            trecStream << indices.at<int>(totalFeatures, 0) << endl;
        }
        trecStream << "</TEXT>" << endl
            << "</DOC>" << endl;

        trecFile.close();
        qDebug() << "Archivo guardado:" << trecFile.fileName();

        //Agrego la imagen al archivo index_source
        sourceStream << "e:\\Proyectos\\Git\\keepc\\release\\cbir\\lemur\\files\\" << featuresCount[i].first + ".trec" << endl;
    }
    sourceFile.close();
}
示例#13
0
	GLShader::GLShader(EGLShaderType type, const string &filename)
		:m_ID(GL_NONE), m_type(type)
	{
		// Check if file exists
		if(!fileExists(filename))
		{
			cerr << "Shader source file '" << filename << "' does not exist." << endl;
		}

		// File exists
		else
		{
			// Create shader
			m_ID = glCreateShader(getShaderTypeConstant(type));

			if(m_ID == GL_NONE)
			{
				cerr << "Could not create OpenGL shader." << endl;
			}

			// Successfully created shader
			else
			{
				cout << "Created OpenGL shader: " << m_ID << endl;

				// Load shader source
				string line, source;
				ifstream sourceStream(filename);
				while(sourceStream.good() && !sourceStream.eof())
				{
					getline(sourceStream, line);
					source.append(line + "\n");
				}

				// Compile shader
				const char *sourceCString = source.c_str();
				glShaderSource(m_ID, 1, &sourceCString, nullptr);
				glCompileShader(m_ID);

				// Check compilation
				GLint compileResult;
				glGetShaderiv(m_ID, GL_COMPILE_STATUS, &compileResult);
				if(compileResult != GL_TRUE)
				{
					cerr << "Shader compilation of file '" << filename << "' failed." << endl;

					GLsizei logLength;
					GLchar  log[1024];
					glGetShaderInfoLog(	m_ID, sizeof(log), &logLength, log);

					cerr << "Shader info log: " << endl << log << endl;
				}

				// Compilation worked
				else
				{
					cout << "Successfully compiled shader '" << filename << "'" << endl;
				}
			}
		}
	}