I did make this website tutorial. I made a spaceship game template sort of.
http://www.alienscribbleinteractive.com/Tutorials/bloom_tutorial.html
1 Like
@AlienScribble Cool! Iβll show that on a Youtube series iβm doing over the development of my game- https://www.youtube.com/watch?v=jSs7gzLcDJY (itβs in Hebrew).
1 Like
Can you post your game draw? And what you do with the renderTarget3?
tkx man!
sorry for late reply, here it is:
protected override void Draw(GameTime gameTime)
{
Texture2D rect = new Texture2D(graphics.GraphicsDevice, 1, 1);
Color[] data = new Color[80 * 30];
for (int i = 0; i < data.Length; ++i) data[i] = Color.Chocolate;
rect.SetData(data);
Vector2 coor = new Vector2(x, y);
DrawSceneToTexture(renderTarget);
DrawCursor(cursor);
bloomcursor = bloom.Draw(gameTime, cursor);
bloomtexture=new RenderTarget2D( GraphicsDevice,
GraphicsDevice.PresentationParameters.BackBufferWidth,
GraphicsDevice.PresentationParameters.BackBufferHeight,
false,
GraphicsDevice.PresentationParameters.BackBufferFormat,
DepthFormat.Depth24);
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone);
GraphicsDevice.SetRenderTarget(null);
GraphicsDevice.Clear(Color.SkyBlue);
spriteBatch.Draw(renderTarget, rec, Color.White);
spriteBatch.Draw(bloomcursor, rec, Color.White);
spriteBatch.Draw(rect, coor, Color.White);
spriteBatch.End();
base.Draw(gameTime);
}
protected void DrawCursor(RenderTarget2D renderTarget)
{
GraphicsDevice.SetRenderTarget(renderTarget);
GraphicsDevice.DepthStencilState = new DepthStencilState() { DepthBufferEnable = true };
GraphicsDevice.Clear(Color.Transparent);
// Draw the scene
spriteBatch.Begin(SpriteSortMode.Immediate,
BlendState.AlphaBlend,
SamplerState.PointClamp,
null, null, null, null);
spriteBatch.Draw(cursorTex, cursorPos, cursorSource,
Color.White, 0.0f, Vector2.Zero, 3f, SpriteEffects.None, 0);
spriteBatch.End();
// Drop the render target
GraphicsDevice.SetRenderTarget(null);
}
protected void DrawSceneToTexture(RenderTarget2D renderTarget)
{
GraphicsDevice.SetRenderTarget(renderTarget);
// Draw the scene
GraphicsDevice.Clear(Color.Transparent);
spriteBatch.Begin(SpriteSortMode.Immediate,
BlendState.AlphaBlend,
SamplerState.PointClamp,
null, null, null, null);
int counter = 0;
for (int h = 0; h < Height; h++)
{
for (int w = 0; w < Width; w++)
{
if (WorldMapBack[h, w] == null)
{
}
else
{
WorldMapBack[h, w].Draw(this.spriteBatch);
counter++;
}
if (WorldMap[h, w] == null)
{
}
else
{
WorldMap[h, w].Draw(this.spriteBatch);
counter++;
}
}
}
mLeavusSprite.Draw(this.spriteBatch);
Debug.WriteLine("blocks: " + counter);
spriteBatch.End();
// Drop the render target
GraphicsDevice.SetRenderTarget(null);
}
}