当前位置: 首页>>代码示例>>C++>>正文


C++ Program::GetProgram方法代码示例

本文整理汇总了C++中Program::GetProgram方法的典型用法代码示例。如果您正苦于以下问题:C++ Program::GetProgram方法的具体用法?C++ Program::GetProgram怎么用?C++ Program::GetProgram使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Program的用法示例。


在下文中一共展示了Program::GetProgram方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ShaderToy

	void Renderer::ShaderToy(std::string pShader, vec2 pPosition, vec2 pSize, std::string pTexture1, std::string pTexture2, std::string pTexture3, std::string pTexture4)
	{
		if (_userPrograms.find(pShader) != _userPrograms.end())
		{
			Program* program = _userPrograms[pShader];
			glUseProgram(program->GetProgram());
			glBindVertexArray(_baseVAO);
			glUniform4f(program->GetUniforms()["PositionSize"].Location, pPosition.x, pPosition.y, pSize.x, pSize.y);
				
			if(pTexture1 != "" && program->IsUniformActive("Texture0"))
				glUniformHandleui64ARB(program->GetUniforms()["Texture0"].Location, _userTextures[pTexture1]->GetHandle());
			if (pTexture2 != "" && program->IsUniformActive("Texture1"))
				glUniformHandleui64ARB(program->GetUniforms()["Texture1"].Location, _userTextures[pTexture2]->GetHandle());
			if (pTexture3 != "" && program->IsUniformActive("Texture2"))
				glUniformHandleui64ARB(program->GetUniforms()["Texture2"].Location, _userTextures[pTexture3]->GetHandle());
			if (pTexture4 != "" && program->IsUniformActive("Texture3"))
				glUniformHandleui64ARB(program->GetUniforms()["Texture3"].Location, _userTextures[pTexture4]->GetHandle());

			if (program->IsUniformActive("iGlobalTime"))
				glUniform1f(program->GetUniforms()["iGlobalTime"].Location, Clock::GetRef().GetTotalTime());
				
			if (program->IsUniformActive("iMouse"))
			{
				vec4 mouse = vec4(
					_uiFunctionPtr->GetCurrentInputPtr()->IsLeftButtonDown() || _uiFunctionPtr->GetCurrentInputPtr()->IsRightButtonDown() ?
					_uiFunctionPtr->GetCurrentInputPtr()->GetMousePosition() : vec2(0.0,0.0), 
					_uiFunctionPtr->GetCurrentInputPtr()->IsLeftButtonDown() ? 1.0 : 0.0,
					_uiFunctionPtr->GetCurrentInputPtr()->IsRightButtonDown() ? 1.0 : 0.0);

				glUniform4f(program->GetUniforms()["iMouse"].Location,mouse.x,mouse.y,mouse.z,mouse.w);
			}

			glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
		}
	}
开发者ID:juliendehos,项目名称:librarium.so,代码行数:35,代码来源:Renderer.cpp

示例2: DrawText

	void Renderer::DrawText(std::string pPath, vec2 pPosition)
	{
		Program* program = _programs["Texture"];
		glUseProgram(program->GetProgram());
		glBindVertexArray(_baseVAO);
		glUniform4f(program->GetUniforms()["PositionSize"].Location, pPosition.x, pPosition.y, (GLfloat)_userTexts[pPath]->GetWidth(), (GLfloat)_userTexts[pPath]->GetHeight());
		glUniformHandleui64ARB(program->GetUniforms()["Texture"].Location, _userTexts[pPath]->GetHandle());
		glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
	}
开发者ID:juliendehos,项目名称:librarium.so,代码行数:9,代码来源:Renderer.cpp

示例3: DrawImage

	void Renderer::DrawImage(GLuint64 pHandle, vec2 pPosition, vec2 pSize)
	{
		Program* program = _programs["Texture"];
		glUseProgram(program->GetProgram());
		glBindVertexArray(_baseVAO);
		glUniform4f(program->GetUniforms()["PositionSize"].Location, pPosition.x, pPosition.y, pSize.x, pSize.y);
		glUniformHandleui64ARB(program->GetUniforms()["Texture"].Location, pHandle);
		glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
	}
开发者ID:juliendehos,项目名称:librarium.so,代码行数:9,代码来源:Renderer.cpp


注:本文中的Program::GetProgram方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。