EFileTahi-A
Contributor
I just want to use DirectX.Direct3D for 2D graphics and I just want to know the esiest way to draw an image on x,y coords with less code as possible but using double buffer.
Ok the following code initializes the Direct3D:
This initializes successfly the 3D device. There is also some things I add/change in my project as sugested by the book from which I learn all this in order to make Direct3D work fine like overriding the .NET builtin OnPaint method.
Anyway the all thing I want is to use Direct3D like GDI+, where I can create an image buffer to draw all the graphics there and then show it. Also I would like to manipulate the buffer image itself to performe some nice effects like, fade it, fade out, color paint etc...
Resuming:
Is this initialization of the DirectX.Direct3D fine for image buffering?
How can draw an image in Direct3D at x,y coords? (load image from HD, draw it to buffer picture and show buffer picture)
After drawing images on Direct3D device, how can I then grab the all screen (containing all the pics drawed (bufferPic)) so that I can then change its color?
Thanks
Ok the following code initializes the Direct3D:
Code:
public void InitializeGraphics()
{
// Set our presentation parameters
PresentParameters presentParams = new PresentParameters();
presentParams.SwapEffect = SwapEffect.Discard;
// Start up full screen
Format current = Manager.Adapters[0].CurrentDisplayMode.Format;
presentParams.Windowed = true;
presentParams.BackBufferFormat = current;
presentParams.BackBufferCount = 1;
presentParams.BackBufferWidth = ScreenWidth;
presentParams.BackBufferHeight = ScreenHeight;
// Create our device
device = new Device(0, DeviceType.Hardware, this,
CreateFlags.SoftwareVertexProcessing, presentParams);
}
//just o quite the application
protected override void OnKeyUp(KeyEventArgs e)
{
if (e.KeyCode == Keys.Escape) // Quit
this.Close();
base.OnKeyUp (e);
}
This initializes successfly the 3D device. There is also some things I add/change in my project as sugested by the book from which I learn all this in order to make Direct3D work fine like overriding the .NET builtin OnPaint method.
Anyway the all thing I want is to use Direct3D like GDI+, where I can create an image buffer to draw all the graphics there and then show it. Also I would like to manipulate the buffer image itself to performe some nice effects like, fade it, fade out, color paint etc...
Resuming:
Is this initialization of the DirectX.Direct3D fine for image buffering?
How can draw an image in Direct3D at x,y coords? (load image from HD, draw it to buffer picture and show buffer picture)
After drawing images on Direct3D device, how can I then grab the all screen (containing all the pics drawed (bufferPic)) so that I can then change its color?
Thanks
Last edited: