このテクスチャを後でスクリーン上でレンダリングできるように、私はtexture2d内にスプライトをレンダリングする必要がありますが、同時に、この変更されたテクスチャのピクセルにアクセスする必要があります。テクスチャ内のスプライトを言い、スプライトがあった座標でgetピクセル関数を呼び出すと、スプライトに対応する新しいピクセル値(texture2dとブレンドされている)を与えるはずです。texture2dにレンダリングする
私は3.5以下ではないxna 4.0を使用しています。
ありがとうございました。
Graphics.FromImage(IMG).DrawImage(等価...はGDI
に私はこれを試み、
public static Texture2D DrawSomething(Texture2D old, int X, int Y, int radius) {
var pp = Res.game.GraphicsDevice.PresentationParameters;
var r = new RenderTarget2D(Res.game.GraphicsDevice, old.Width, old.Height, false, pp.BackBufferFormat, pp.DepthStencilFormat,
pp.MultiSampleCount, RenderTargetUsage.DiscardContents);
Res.game.GraphicsDevice.SetRenderTarget(r);
var s = new SpriteBatch(r.GraphicsDevice);
s.Begin();
s.Draw(old, new Vector2(0, 0), Color.White);
s.Draw(Res.picture, new Rectangle(X - radius/2, Y - radius/2, radius, radius), Color.White);
s.End();
Res.game.GraphicsDevice.SetRenderTarget(null);
return r;
}
Res.gameは、基本的にメインゲームフォームへのポインタで失敗したとRes.pictureはランダムにTexture2D
どのように???私はこれを試して、それは私のアプリをフリーズする。 更新をチェック(編集) – luis
あなたのコードを表示できますか? – annonymously
ああ申し訳ありません、私はそれを貼り付けていました。もう一度チェックしてください – luis