Skip to main content
gamedev.net
🔒 Locked

sprite.Begin(...) transperency ?

Started by _Tank_ 0 replies 850+ views
Original Post
_Tank_
_Tank_
Hi all. I have come to next piece of code which is actualy does what i want(displays both textures): static_texture does not contain transperent pixels dynamic_texture contains transperent pixels sprite.Begin(SpriteFlags.None); sprite.Draw2D(static_texture, Rectangle.Empty, SizeF.Empty, new PointF(0, 0), Color.Transparent); sprite.End(); sprite.Begin(SpriteFlags.AlphaBlend); sprite.Draw2D(dynamic_texture, Rectangle.Empty, SizeF.Empty, new PointF(256, 256), Color.Green); sprite.End(); I suppose that two sprite.Begin()...sprite.End() operations are time consuming. is it possible to display both transperent and non transperent textures in one sprite.Begin()...sprite.End() block. Is the next piece of code possible without disrupting the static_texture pixels: sprite.Begin(SpriteFlags.AlphaBlend); sprite.Draw2D(static_texture, Rectangle.Empty, SizeF.Empty, new PointF(0, 0), Color.Transparent); sprite.Draw2D(dynamic_texture, Rectangle.Empty, SizeF.Empty, new PointF(256, 256), Color.Green); sprite.End(); Becouse as a result of above operation i get all the white color filled with the color specified in sprite.Draw2D(..., Color.THE_COLOR). By the way if Color.THE_COLOR = Color.Transperency then the static_texture is invisible is sprite.Begin(...) is fast enough and should i leave those two sprite.Begin()...sprite.End() blocks ??? [Edited by - _Tank_ on April 5, 2006 1:28:04 PM]
Armadon
Armadon
Usually you need some way of measuring these kinds of things. What are you measuring it against? What do you want the metrics to be?
I would say that it's pretty close to the unmanaged ID3DXSprite's Begin method and so you shouldn't be worried. The whole reason behind ID3DXSprite and Sprite is simplicity.

I hope this helps.
Take care.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.