本文整理汇总了C#中SFML.Graphics.Shader.SetUniform方法的典型用法代码示例。如果您正苦于以下问题:C# Shader.SetUniform方法的具体用法?C# Shader.SetUniform怎么用?C# Shader.SetUniform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SFML.Graphics.Shader
的用法示例。
在下文中一共展示了Shader.SetUniform方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Pixelate
public Pixelate() : base("pixelate")
{
// Load the texture and initialize the sprite
myTexture = new Texture("resources/background.jpg");
mySprite = new Sprite(myTexture);
// Load the shader
myShader = new Shader(null, null, "resources/pixelate.frag");
myShader.SetUniform("texture", Shader.CurrentTexture);
}
示例2: Edge
public Edge() : base("edge post-effect")
{
// Create the off-screen surface
mySurface = new RenderTexture(800, 600);
mySurface.Smooth = true;
// Load the textures
myBackgroundTexture = new Texture("resources/sfml.png");
myBackgroundTexture.Smooth = true;
myEntityTexture = new Texture("resources/devices.png");
myEntityTexture.Smooth = true;
// Initialize the background sprite
myBackgroundSprite = new Sprite(myBackgroundTexture);
myBackgroundSprite.Position = new Vector2f(135, 100);
// Load the moving entities
myEntities = new Sprite[6];
for (int i = 0; i < myEntities.Length; ++i)
{
myEntities[i] = new Sprite(myEntityTexture, new IntRect(96 * i, 0, 96, 96));
}
// Load the shader
myShader = new Shader(null, null, "resources/edge.frag");
myShader.SetUniform("texture", Shader.CurrentTexture);
}