我想提一下银灯-PeneApplicationPage及其对我作为三角洲的一些广场的控制。
周围的另一种方式是完全细微的,但广场是我的控制之上的——我是在我的缩编工作中这样做的:
private void OnDraw(object sender, GameTimerEventArgs e)
{
// Clean up device
graphicsDevice.Clear(Microsoft.Xna.Framework.Color.Black);
graphicsDevice.BlendState = BlendState.AlphaBlend;
RasterizerState stat = new RasterizerState();
stat.CullMode = CullMode.None;
graphicsDevice.RasterizerState = stat;
// Draw Silverlight UI element to Texture
elementRenderer.Render();
// Draw Silverlight UI element
spriteBatch.Begin();
spriteBatch.Draw(elementRenderer.Texture, Vector2.Zero, Microsoft.Xna.Framework.Color.White);
spriteBatch.End();
effect.Texture = tex;
effect.TextureEnabled = true;
effect.World = BillboardMatrix;
effect.View = view;
effect.Projection = projection;
foreach (EffectPass pass in effect.CurrentTechnique.Passes)
{
pass.Apply();
graphicsDevice.DrawUserPrimitives<VertexPositionTexture>(PrimitiveType.TriangleStrip, vertices, 0, 2);
}
}
If I try to draw the spriteBatch after the Triangles I get this error: "NotSupportedException - XNA Framework Reach profile requires TextureAddressMode to be Clamp when using texture sizes that are not powers of two."
private void OnDraw(object sender, GameTimerEventArgs e)
{
// Clean up device
graphicsDevice.Clear(Microsoft.Xna.Framework.Color.Black);
graphicsDevice.BlendState = BlendState.AlphaBlend;
RasterizerState stat = new RasterizerState();
stat.CullMode = CullMode.None;
graphicsDevice.RasterizerState = stat;
// Draw Silverlight UI element to Texture
elementRenderer.Render();
effect.Texture = tex;
effect.TextureEnabled = true;
effect.World = BillboardMatrix;
effect.View = view;
effect.Projection = projection;
foreach (EffectPass pass in effect.CurrentTechnique.Passes)
{
pass.Apply();
graphicsDevice.DrawUserPrimitives<VertexPositionTexture>(PrimitiveType.TriangleStrip, vertices, 0, 2);
}
// Draw Silverlight UI element
spriteBatch.Begin();
spriteBatch.Draw(elementRenderer.Texture, Vector2.Zero, Microsoft.Xna.Framework.Color.White);
spriteBatch.End();
}
I also tried to set graphicsDevice.SamplerStates[i] = SamplerState.LinearClamp;
but it didn t work. What am I doing wrong?