本文整理汇总了C++中Program::GetUniforms方法的典型用法代码示例。如果您正苦于以下问题:C++ Program::GetUniforms方法的具体用法?C++ Program::GetUniforms怎么用?C++ Program::GetUniforms使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Program
的用法示例。
在下文中一共展示了Program::GetUniforms方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: 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);
}
示例3: 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);
}
}