예제 #1
0
    bool Shader::checkCompileErrors( GLuint shader, std::string type ) {
        GLint success;
        GLint infoLogLength = 0;
        if ( type != "PROGRAM" ) {
            glGetShaderiv( shader, GL_COMPILE_STATUS, &success );
            if ( !success ) {
                glGetShaderiv( shader, GL_INFO_LOG_LENGTH, &infoLogLength );
                std::vector<GLchar> infoLog( glm::max( infoLogLength, int( 1 ) ) );
                glGetShaderInfoLog( shader, infoLogLength, nullptr, &infoLog[0] );

                wxLogMessage( wxT( "Shader compilation error::%s:\n%s" ), type, &infoLog[0] );
                return false;
            }
        } else {
            glGetProgramiv( shader, GL_LINK_STATUS, &success );
            if ( !success ) {
                glGetShaderiv( shader, GL_INFO_LOG_LENGTH, &infoLogLength );
                std::vector<GLchar> infoLog( glm::max( infoLogLength, int( 1 ) ) );
                glGetShaderInfoLog( shader, infoLogLength, nullptr, &infoLog[0] );

                wxLogMessage( wxT( "Shader program linking error::%s:\n%s" ), type, &infoLog[0] );
                return false;
            }
        }
        return true;
    }
bool WMHeadPositionCorrection::processInit( WLEMMCommand::SPtr cmdIn )
{
    infoLog() << "Initializing module.";
    m_correction.setMovementThreshold( m_propMvThreshold->get( false ) );
    m_correction.setSphereRadius( m_propRadius->get( false ) );

    if( cmdIn->hasEmm() )
    {
        WLEMMeasurement::SPtr emm = cmdIn->getEmm();
        if( emm->hasModality( WLEModality::MEG ) )
        {
            WLEMDMEG::SPtr meg = emm->getModality< WLEMDMEG >( WLEModality::MEG );
            WLEMDMEG::createCoilInfos( meg.get() );
            m_correction.setMegCoilInfos( meg->getCoilInformation() );
        }
        if( !m_hasRefPos && !emm->getHpiInfo()->getDevToHead()->empty() )
        {
            WLEMMHpiInfo::TransformationT::SPtr t = emm->getHpiInfo()->getDevToHead()->inverse();
            m_correction.setRefTransformation( *t );
            m_hasRefPos = true;
            m_propStatus->set( STATUS_REF_POS, true );
            infoLog() << "Set reference position from EMM: \n" << *t;
        }
    }

    return m_correction.init();
}
예제 #3
0
void BaseProgramRenderPass::Link()
{
	RETURN_IF(mProgramState->Program()==0||mIsLinked);
	SAFE_DELETE_DICTIONARY_VALUE(mUniforms);
	SAFE_DELETE_DICTIONARY_VALUE(mAttributes);

	uint program=mProgramState->Program();
	Render::Instance().LinkProgram(program);
	int outLinkStatus=Render::Instance().GetProgramStatus(program,GraphicsProgramStatus::LinkStatus);

	if (!outLinkStatus)
	{
		//link error
		int outInfoLogLength=Render::Instance().GetProgramStatus(program,GraphicsProgramStatus::InfoLogLength);

		HeapString infoLog((size_t)outInfoLogLength+1,true);
		Render::Instance().GetProgramInfoLog(program,infoLog);
		Log::FormatError("Failed to link effect:{}",infoLog.Buffer());
		Uninitialize();
		return ;
	}

	Render::Instance().ValidateProgram(program);
	int outValidateStatus=Render::Instance().GetProgramStatus(program,GraphicsProgramStatus::ValidateStatus);

	if (!outValidateStatus)
	{
		//link error
		int outInfoLogLength=Render::Instance().GetProgramStatus(program,GraphicsProgramStatus::InfoLogLength);

		HeapString infoLog((size_t)outInfoLogLength+1,true);
		Render::Instance().GetProgramInfoLog(program,infoLog);
		Log::FormatError("Failed to validate effect:{}",infoLog.Buffer());
		Uninitialize();
		return;
	}
	RenderStateMachine::Instance().Push(mProgramState);

	//add all uniforms
	uint uniformCount=(uint)Render::Instance().GetProgramStatus(program,GraphicsProgramStatus::ActiveUniformCount);
	uint maxUniformNameLength=(uint)Render::Instance().GetProgramStatus(program,GraphicsProgramStatus::MaxActiveUniformNameLength);
	HeapString outName((size_t)maxUniformNameLength+1,true);
	FOR_EACH_SIZE(i,uniformCount)
	{
		int outSize;
		uint outDataType;
		Render::Instance().GetActiveUniformName(program,static_cast<uint>(i),outSize,outDataType,outName);
		int index= Render::Instance().GetUniformLocation(program,outName);	//NOTE: Cannot use i as index
		ShaderUniform* uniform=new ShaderUniform(this,index,outName,(GraphicsUniformDataType)outDataType);
		mUniforms.Add(outName,uniform);
	}
void WMHeadPositionCorrection::moduleInit()
{
    infoLog() << "Initializing module ...";

    m_moduleState.setResetable( true, true ); // resetable, autoreset
    m_moduleState.add( m_input->getDataChangedCondition() ); // Wake up when input data changed
    m_moduleState.add( m_propCondition ); // Wake up when property changed

    ready(); // signal ready state
    waitRestored();

    m_hasRefPos = hdlPosFileChanged( m_propPosFile->get().string() );
    viewInit( WLEMDDrawable2D::WEGraphType::DYNAMIC );

    infoLog() << "Initializing module finished!";
}
예제 #5
0
	void GLSLProgram::LinkShaders()
	{	
		glAttachShader(_progID, _vertShaderID);
		glAttachShader(_progID, _fragShaderID);
		
		glLinkProgram(_progID);
		
		GLint isLinked = 0;
		glGetProgramiv(_progID, GL_LINK_STATUS, (int*)&isLinked);
		
		if(isLinked == GL_FALSE)
		{
			GLint maxLength = 0;
			glGetProgramiv(_progID, GL_INFO_LOG_LENGTH, &maxLength);
			std::vector<char> infoLog(maxLength);
			glGetProgramInfoLog(_progID, maxLength, &maxLength, &infoLog[0]);
			
			glDeleteProgram(_progID);
			
			glDeleteShader(_vertShaderID);
			glDeleteShader(_fragShaderID);
			
			puts(&infoLog[0]);
			
			return;
		}
		glDetachShader(_progID, _vertShaderID);
		glDetachShader(_progID, _fragShaderID);
		glDeleteShader(_vertShaderID);
		glDeleteShader(_fragShaderID);
	}
예제 #6
0
파일: glabs.cpp 프로젝트: hi2p-perim/glabs
void GLShader::CompileString( ShaderType type, const std::string& content )
{
	// Create and compile shader
	GLuint shaderID = glCreateShader(type);
	const char* contentPtr = content.c_str();

	glShaderSource(shaderID, 1, &contentPtr, NULL);
	glCompileShader(shaderID);

	// Check errors
	int ret;
	glGetShaderiv(shaderID, GL_COMPILE_STATUS, &ret);

	if (ret == 0)
	{
		// Required size
		int length;
		glGetShaderiv(shaderID, GL_INFO_LOG_LENGTH, &length);

		// Get info log
		boost::scoped_array<char> infoLog(new char[length]);
		glGetShaderInfoLog(shaderID, length, NULL, infoLog.get());
		glDeleteShader(shaderID);

		std::stringstream ss;
		ss << "[" << ShaderTypeString(type) << "]" << std::endl;
		ss << infoLog.get() << std::endl;

		THROW_GL_EXCEPTION(GLException::ShaderCompileError, ss.str());
	}

	// Attach to the program
	glAttachShader(id, shaderID);
	glDeleteShader(shaderID);
}
예제 #7
0
	void GLSLProgram::linkShaders()
	{
		glAttachShader(m_programID, m_vertexShaderID);
		glAttachShader(m_programID, m_fragmentShaderID);

		glLinkProgram(m_programID);

		GLint isLinked = 0;
		glGetProgramiv(m_programID, GL_LINK_STATUS, (int*)&isLinked);
		if (isLinked == GL_FALSE)
		{
			GLint maxLenght = 0;
			glGetProgramiv(m_programID, GL_INFO_LOG_LENGTH, &maxLenght);

			std::vector<char> infoLog(maxLenght);
			glGetProgramInfoLog(m_programID, maxLenght, &maxLenght, &infoLog[0]);

			glDeleteShader(m_programID);
			glDeleteShader(m_vertexShaderID);
			glDeleteShader(m_fragmentShaderID);

			std::printf("%s\n", &(infoLog[0]));
			fatalError("Shaders failed to link !");
		}

		glDetachShader(m_programID, m_vertexShaderID);
		glDetachShader(m_programID, m_fragmentShaderID);
		glDeleteShader(m_vertexShaderID);
		glDeleteShader(m_fragmentShaderID);
	}
예제 #8
0
GLuint ShaderProgram::makeCompiledShader(const std::string& _src, GLenum _type) {

    GLuint shader = glCreateShader(_type);
    const GLchar* source = (const GLchar*) _src.c_str();
    glShaderSource(shader, 1, &source, NULL);
    glCompileShader(shader);

    GLint isCompiled;
    glGetShaderiv(shader, GL_COMPILE_STATUS, &isCompiled);

    if (isCompiled == GL_FALSE) {
        GLint infoLength = 0;
        glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLength);
        if (infoLength > 1) {
            std::vector<GLchar> infoLog(infoLength);
            glGetShaderInfoLog(shader, infoLength, NULL, &infoLog[0]);
            logMsg("Error compiling shader:\n%s\n", &infoLog[0]);
        }
        glDeleteShader(shader);
        return 0;
    }

    return shader;

}
예제 #9
0
static void
CompileShader(GLuint shaderId, const std::string sourceFile)
{
    std::string shaderSrc;
    std::ifstream file { sourceFile };

    if (file.is_open()) {
        std::string ln;

        while (std::getline(file, ln))
            shaderSrc += "\n" + ln;
    } else {
        std::cerr << "Warning: failed to open vertex shader source file." << std::endl;
        exit(1);
    }

    GLint result = GL_FALSE;
    GLint infoLogLength;
    char const *shaderSrcPtr = shaderSrc.c_str();

    glShaderSource(shaderId, 1, &shaderSrcPtr, nullptr);
    glCompileShader(shaderId);
    glGetShaderiv(shaderId, GL_COMPILE_STATUS, &result);
    glGetShaderiv(shaderId, GL_INFO_LOG_LENGTH, &infoLogLength);

    std::vector<char> infoLog(infoLogLength);

    glGetShaderInfoLog(shaderId, infoLogLength, nullptr, &infoLog[0]);
    std::cerr << &infoLog[0] << std::endl;
}
예제 #10
0
/** Create a shader from ASCII string.
  *  @param [in] type Shader type.
  *  @param [in] in Shader source code.
  *  @return true the shader was successfully created and compiled.
  */
bool Shader::create(Shader::Type type, char const * in)
{
    GLenum internalType;
    /* Sanity check. */
    if(NULL == in)
    {
        return false;
    }
    internalType = translateType(type);
    if(GL_INVALID_ENUM == internalType)
    {
        return false;
    }
    _type = type;

    _id = glCreateShader(internalType);
    /* @todo check for errors */

    glShaderSource(_id, 1, const_cast<GLchar const **>(&in), NULL);
    /* @todo check for errors */

    glCompileShader(_id);
    /* @todo check for error */

    GLint result;
    glGetShaderiv(_id, GL_COMPILE_STATUS, &result);
    if(GL_FALSE == result)
    {
        infoLog();
        return false;
    }
    return true;
}
예제 #11
0
GLuint CompileShader(GLenum type, const std::string &source)
{
    GLuint shader = glCreateShader(type);

    const char *sourceArray[1] = { source.c_str() };
    glShaderSource(shader, 1, sourceArray, NULL);
    glCompileShader(shader);

    GLint compileResult;
    glGetShaderiv(shader, GL_COMPILE_STATUS, &compileResult);

    if (compileResult == 0)
    {
        GLint infoLogLength;
        glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLogLength);

        std::vector<GLchar> infoLog(infoLogLength);
        glGetShaderInfoLog(shader, infoLog.size(), NULL, infoLog.data());

        std::cerr << "shader compilation failed: " << infoLog.data();

        glDeleteShader(shader);
        shader = 0;
    }

    return shader;
}
예제 #12
0
GLuint CompileShader(GLenum type, const std::string &source)
{
    GLuint shader = glCreateShader(type);

    const char *sourceArray[1] = { source.c_str() };
    glShaderSource(shader, 1, sourceArray, NULL);
    glCompileShader(shader);

    GLint compileResult;
    glGetShaderiv(shader, GL_COMPILE_STATUS, &compileResult);

    if (compileResult == 0)
    {
        GLint infoLogLength;
        glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLogLength);

        std::vector<GLchar> infoLog(infoLogLength);
        glGetShaderInfoLog(shader, (GLsizei)infoLog.size(), NULL, infoLog.data());

        std::string errorMessage = std::string("Shader compilation failed: ");
        errorMessage += std::string(infoLog.begin(), infoLog.end()); 

        throw std::runtime_error(errorMessage.c_str());
    }

    return shader;
}
예제 #13
0
GLuint ANGLETest::compileShader(GLenum type, const std::string &source)
{
    GLuint shader = glCreateShader(type);

    const char *sourceArray[1] = { source.c_str() };
    glShaderSource(shader, 1, sourceArray, NULL);
    glCompileShader(shader);

    GLint compileResult;
    glGetShaderiv(shader, GL_COMPILE_STATUS, &compileResult);

    if (compileResult == 0)
    {
        GLint infoLogLength;
        glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLogLength);

        if (infoLogLength == 0)
        {
            std::cerr << "shader compilation failed with empty log." << std::endl;
        }
        else
        {
            std::vector<GLchar> infoLog(infoLogLength);
            glGetShaderInfoLog(shader, static_cast<GLsizei>(infoLog.size()), NULL, &infoLog[0]);

            std::cerr << "shader compilation failed: " << &infoLog[0];
        }

        glDeleteShader(shader);
        shader = 0;
    }

    return shader;
}
예제 #14
0
Shader createShader(GLenum shaderType, const std::string &glslVersion, const std::string &shaderSource) {
    Shader shader(glCreateShader(shaderType));
    if (!shader) {
        throw OpenGLException("Shader creation failed", glGetError());
    }
    
    const std::array<const GLchar *, 5> strings = {
        "#version ", glslVersion.data(), "\n",
        "precision highp float;\n",
        shaderSource.data()
    };
    glShaderSource(shader.get(), strings.size(), strings.data(), nullptr);
    glCompileShader(shader.get());
    
    GLint infoLogLength;
    glGetShaderiv(shader.get(), GL_INFO_LOG_LENGTH, &infoLogLength);
    if (infoLogLength > 0) {
        std::vector<GLchar> infoLog(infoLogLength);
        glGetShaderInfoLog(shader.get(), infoLogLength, nullptr, infoLog.data());
        mwarning(M_DISPLAY_MESSAGE_DOMAIN,
                 "OpenGL: Shader compilation produced the following information log:\n%s",
                 infoLog.data());
    }
    
    GLint compileStatus;
    glGetShaderiv(shader.get(), GL_COMPILE_STATUS, &compileStatus);
    if (compileStatus != GL_TRUE) {
        throw OpenGLException("Shader compilation failed");
    }
    
    return shader;
}
예제 #15
0
Program createProgram(const std::vector<GLuint> &shaders) {
    Program program(glCreateProgram());
    if (!program) {
        throw OpenGLException("Program creation failed", glGetError());
    }
    
    for (GLuint shader : shaders) {
        glAttachShader(program.get(), shader);
        GLenum error = glGetError();
        if (error != GL_NO_ERROR) {
            throw OpenGLException("Shader attachment failed", error);
        }
    }
    
    glLinkProgram(program.get());
    
    GLint infoLogLength;
    glGetProgramiv(program.get(), GL_INFO_LOG_LENGTH, &infoLogLength);
    if (infoLogLength > 0) {
        std::vector<GLchar> infoLog(infoLogLength);
        glGetProgramInfoLog(program.get(), infoLogLength, nullptr, infoLog.data());
        mwarning(M_DISPLAY_MESSAGE_DOMAIN,
                 "OpenGL: Program linking produced the following information log:\n%s",
                 infoLog.data());
    }
    
    GLint linkStatus;
    glGetProgramiv(program.get(), GL_LINK_STATUS, &linkStatus);
    if (linkStatus != GL_TRUE) {
        throw OpenGLException("Program linking failed");
    }
    
    return program;
}
예제 #16
0
파일: Shader.cpp 프로젝트: santa01/graphene
GLuint Shader::link(const std::vector<GLuint>& shaders) {
    GLuint program = glCreateProgram();

    for (auto& shader: shaders) {
        glAttachShader(program, shader);
        glDeleteShader(shader);
    }

    glLinkProgram(program);

    GLint linkStatus;
    glGetProgramiv(program, GL_LINK_STATUS, &linkStatus);

    if (linkStatus == GL_FALSE) {
        GLint infoLogLength;
        glGetProgramiv(program, GL_INFO_LOG_LENGTH, &infoLogLength);

        std::unique_ptr<GLchar[]> infoLog(new GLchar[infoLogLength]);
        glGetProgramInfoLog(program, infoLogLength, nullptr, infoLog.get());
        glDeleteProgram(program);

        throw std::runtime_error(infoLog.get());
    }

    return program;
}
예제 #17
0
void Program::link()
{
    GLES2_ERROR_CHECK_UNHANDLED();
    glLinkProgram( this->id );
    GLES2_ERROR_CHECK("glLinkProgram");

    int isLinked;
    glGetProgramiv( this->id, GL_LINK_STATUS, &isLinked );
    if( !isLinked )
    {
        GLint infoLen = 0;
        glGetProgramiv( this->id, GL_INFO_LOG_LENGTH, &infoLen );

        if( infoLen > 1 )
        {
            std::unique_ptr< GLchar[] > infoLog( new GLchar[infoLen] );
            glGetProgramInfoLog( this->id, infoLen, NULL, infoLog.get() );
            GLES2_ERROR_CHECK("glGetProgramInfoLog");
            std::string log( infoLog.get(), infoLen-1 );
            glDeleteProgram( this->id );
            throw RUNTIME_ERROR
            (
                "Error linking shader program:\n"
                "----------------\n"
                +log+"\n"
                "----------------\n"
            );
        }
        else
        {
            glDeleteProgram( this->id );
            throw RUNTIME_ERROR( "Error linking shader program! (no log generated)\n" );
        }
    }
}
bool WMHeadPositionCorrection::processReset( WLEMMCommand::SPtr cmdIn )
{
    WL_UNUSED( cmdIn );
    infoLog() << "Reseting module.";
    m_correction.reset();
    m_hasRefPos = hdlPosFileChanged( m_propPosFile->get().string() );
    return true;
}
예제 #19
0
bool Program::checkLinkStatus() const
{
    if (GL_FALSE == static_cast<GLboolean>(get(GL_LINK_STATUS)))
    {
        critical() << "Linker error:" << std::endl << infoLog();
        return false;
    }
    return true;
}
예제 #20
0
	inline void printProgramInfoLog(GLuint obj) {
		int infologLength = 0;
		int charsWritten = 0;
		glGetProgramiv(obj, GL_INFO_LOG_LENGTH, &infologLength);
		if (infologLength > 1) {
			std::vector<char> infoLog(infologLength);
			glGetProgramInfoLog(obj, infologLength, &charsWritten, &infoLog[0]);
			std::cout << "SimpleShader : " << "PROGRAM :\n" << &infoLog[0] << std::endl;
		}
	}
예제 #21
0
void PrintShaderInfoLog(int obj)
{
    int infologLength = 0;
    int charsWritten  = 0;
    glGetShaderiv(obj, GL_INFO_LOG_LENGTH, &infologLength);
    if (infologLength > 0)
	{
        std::vector<char> infoLog(infologLength);
        glGetShaderInfoLog(obj, infologLength, &charsWritten, &infoLog[0]);
		fprintf(stderr, "%s", (char*)(&infoLog[0]));
    }
}
예제 #22
0
	void GLSLProgram::CompileAndLinkShaders(const std::vector< std::string >& vsps, const std::vector< std::string >& fsps)
	{
		_progID = glCreateProgram();
		
		std::vector<std::pair<std::string, GLuint>> shader_keys;
		
		// Create all shaders from each array
		for(auto path : vsps)
		{
			shader_keys.push_back(std::pair<std::string, GLuint>(path, glCreateShader(GL_VERTEX_SHADER)));
		}
		for(auto path : fsps)
		{
			shader_keys.push_back(std::pair<std::string, GLuint>(path, glCreateShader(GL_FRAGMENT_SHADER)));
		}
		// Compile all shaders
		for(auto shader : shader_keys)
		{
			compileShader(shader.first, shader.second);
			// Now add all shaders to program
			glAttachShader(_progID, shader.second);
		}
		// Link the program
		glLinkProgram(_progID);
		
		GLint isLinked = 0;
		glGetProgramiv(_progID, GL_LINK_STATUS, (int*)&isLinked);
		
		if(isLinked == GL_FALSE)
		{
			GLint maxLength = 0;
			glGetProgramiv(_progID, GL_INFO_LOG_LENGTH, &maxLength);
			std::vector<char> infoLog(maxLength);
			glGetProgramInfoLog(_progID, maxLength, &maxLength, &infoLog[0]);
			
			glDeleteProgram(_progID);
			
			glDeleteShader(_vertShaderID);
			glDeleteShader(_fragShaderID);
			
			puts(&infoLog[0]);
			
			return;
		}
		
		// Detach and then delete all shaders
		for(auto shader : shader_keys)
		{
			glDetachShader(_progID, shader.second);
			glDeleteShader(shader.second);
		}

	}
예제 #23
0
std::string gle::Program::getInfoLog() const
{
  GLint length;

  glGetProgramiv(_id, GL_INFO_LOG_LENGTH, &length);
  if (length <= 0)
    return ("");
  char *buffer = new char[length];
  glGetProgramInfoLog(_id, length, NULL, buffer);
  std::string infoLog(buffer);
  delete[] buffer;
  return (infoLog);
}
예제 #24
0
QString Logger::infoLog(QSqlQuery *query) const
{
    QString info;
    if(!query->first()){
        return info;
    }
    do{
        QSqlRecord record = query->record();
        info.append(infoLog(record));
    }
    while(query->next());
    return info;
}
예제 #25
0
bool ProgramPipeline::checkUseStatus() const
{
    validate();

    if (!isValid())
    {
        critical() << "Use error:" << std::endl << infoLog();

        return false;
    }

    return true;
}
예제 #26
0
BOOL ClientInfoManager::InstallModule( LPCTSTR clientid, LPCTSTR moduleName )
{
	tstring modname = moduleName;
	makeLower(modname);
	tstring datFilepath;
	if (! ClientmodManager::GetInstanceRef().GetModuleDatFilepath(modname.c_str(), datFilepath))
	{
		errorLog(_T("no such clientmodule [%s]"), moduleName);
		return FALSE;
	}

	CommData sendData;
	sendData.SetMsgID(MSGID_INSTALL_MODULE);
	sendData.SetData(_T("modname"), moduleName);

	if (! ReadDataFile(datFilepath.c_str(), sendData))
	{
		errorLog(_T("read datafile failed[%s]"), datFilepath.c_str());
		return FALSE;
	}

	MSGSERIALID requestInstallModMsgID = CommManager::GetInstanceRef().AddToSendMessage(clientid, sendData, TRUE);
	if (INVALID_MSGSERIALID == requestInstallModMsgID)
	{
		errorLog(_T("send msg to install mod[%s] in [%s] failed"), moduleName, clientid);
		return FALSE;
	}

	BOOL bPushOK = FALSE;
	m_infoMapSection.Enter();
	{
		ClientBaseInfoMap::iterator iter = m_clientBaseInfoMap.find(clientid);
		if (iter != m_clientBaseInfoMap.end())
		{
			iter->second.installModMsgIDMap[moduleName] = requestInstallModMsgID;
			bPushOK = TRUE;
		}
	}
	m_infoMapSection.Leave();

	if (bPushOK)
	{
		infoLog(_T("send install msg OK. install mod[%s] to [%s]"), moduleName, clientid);
	}
	else
	{
		errorLog(_T("send install msg OK.id=%I64u. but no info for client[%s]"), requestInstallModMsgID, clientid);
	}

	return TRUE;
}
예제 #27
0
	std::string Program::GetInfoLog()
	{
		GLint res;
		glGetProgramiv( obj, GL_INFO_LOG_LENGTH, &res );

		if ( res > 0 )
		{
			std::string infoLog( res, 0 );
			glGetProgramInfoLog( obj, res, &res, &infoLog[0] );
			return infoLog;
		} else {
			return "";
		}
	}
void WMTemplateRoiSelection::moduleInit()
{
    infoLog() << "Initializing module " << getName();

    // init moduleState for using Events in mainLoop
    m_moduleState.setResetable( true, true ); // resetable, autoreset
    m_moduleState.add( m_input->getDataChangedCondition() ); // when inputdata changed
    m_moduleState.add( m_propCondition ); // when properties changed

    ready(); // signal ready state
    waitRestored();

    viewInit( WLEMDDrawable2D::WEGraphType::SINGLE );
}
예제 #29
0
bool checkProgramLinkStatus(GLuint program) {
    GLint isLinked = 0;
    glGetProgramiv(program, GL_LINK_STATUS, (int *) &isLinked);
    if (isLinked == GL_FALSE) {
        GLint maxLength = 0;
        glGetProgramiv(program, GL_INFO_LOG_LENGTH, &maxLength);

        std::vector<GLchar> infoLog(maxLength);
        glGetProgramInfoLog(program, maxLength, &maxLength, &infoLog[0]);

        fprintf(stderr, "Linking failed: %s\n", infoLog.data());
        return false;
    }
    return true;
}
예제 #30
0
void GLSL_LogReport(int shader, bool is_print){
  GLint maxLength = 0;
  glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &maxLength);

  // max length includes the NULL character
  std::vector<GLchar> infoLog(maxLength);
  glGetShaderInfoLog(shader, maxLength, &maxLength, &infoLog[0]);
  
  if (is_print){
    for(int i = 0; i < infoLog.size(); ++i) {
      cout<<infoLog[i];
    }
  }
  cout<<endl;
}