rifter1818
Well-known member
Proof of problem with sprites DX9.0C?
The following program is just a simple WindowsApplication with the following adjustments
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!
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();
}
}
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 by a moderator: