Directx 9.0C Driving me nuts

rifter1818

Junior Contributor
Joined
Sep 11, 2003
Messages
255
Location
A cold dark place
Proof of problem with sprites DX9.0C?

The following program is just a simple WindowsApplication with the following adjustments
C#:
//Add Refrecnce to Directx,Direct3d,Direct3dx
...
using Microsoft.Directx;
using Microsoft.Direct3D;
...
Device dev;
Sprite s;
Texture t;
public Form1()
{
	InitializeComponent();
	PresentParameters pp = new PresentParameters();
	pp.Windowed = true;
	pp.SwapEffect = SwapEffect.Discard;
	pp.BackBufferHeight = 768;
	pp.BackBufferWidth = 1024;
	this.Show();
	dev = new Device(0,DeviceType.Hardware,this,CreateFlags.SoftwareVertexProcessing,pp);
	dev.RenderState.Lighting = false;
	s = new Sprite(dev);
	t = TextureLoader.FromFile(dev,"C:\\Test.bmp");
	Render();
}
void Render()
{
	for(int i = 0;i<600;i++)
	{
		dev.Clear(ClearFlags.Target,Color.Black,0,0);
		dev.BeginScene();
		s.Begin(SpriteFlags.None);
		s.Draw2D(t,new Point(32,32),0,new Point(32,32),Color.White);
		s.Draw2D(t,Rectangle.Empty,Rectangle.Empty,new Point(512,384),Color.White);
		s.End();
		dev.EndScene();
		dev.Present();
		Application.DoEvents();
	}
}
Note The Form is set to start Maximized.
The above code does indeed render both sprites fine, however if I comment out the first s.draw2d neither render!
Problem is that i want to draw my sprites using the second type of rendering but it doesnt seem to draw without the other being called first!
 
Last edited:
hmm, why don't you try transforming and/or scaling the world (if they're different sizes) rather than than drawing 2..

btw, could you please explain what these arguments are:
s.Draw2D(t,new Point(32,32),0,new Point(32,32),Color.White);
s.Draw2D(t,Rectangle.Empty,Rectangle.Empty,new Point(512,384),Color.White);

Im confused as to which is Width/Height and which is x,y,z

pent
 
Back
Top