PDA

View Full Version : Forms in DirectX



Gadget
18-05-2003, 11:29 AM
How can I get forms working in DirectX? Do I need to create my own TDXForm? Can anyone give me any pointers on solutions to this problem? How do you do it?

Thanks

Gadget
03-06-2003, 08:04 PM
*bump*

Ultra
03-06-2003, 08:32 PM
I'm probably stupid but what exactly do you want? Do you want to use DirectX to draw on your form (then it should be something like myDirectDraw.SetCooperativeLevel(MyForm.Handle, DDSCL_FULLSCREEN or DDSCL_EXCLUSIVE or DDSCL_ALLOWREBOOT)) or do you want to have a form pop up at runtime? Then this link (http://groups.yahoo.com/group/JEDI-DirectXExamples/files/DirectDraw/) may be useful (FullscreenDialog I think).

I guess it's the same thing with Direct3D.

Gadget
10-06-2003, 08:56 AM
I'm probably stupid but what exactly do you want? Do you want to use DirectX to draw on your form (then it should be something like myDirectDraw.SetCooperativeLevel(MyForm.Handle, DDSCL_FULLSCREEN or DDSCL_EXCLUSIVE or DDSCL_ALLOWREBOOT)) or do you want to have a form pop up at runtime? Then this [url=http://groups.yahoo.com/group/JEDI-DirectXExamples/files/DirectDraw/] ] may be useful (FullscreenDialog I think).

I guess it's the same thing with Direct3D.

Thanks for that link, it may help me to work out what I need. Basically I want to show TForms inside my DX application. It's fullscreen so I guess that TForm wont get drawn.

Clootie
11-06-2003, 05:07 AM
What DirectX version?

Gadget
11-06-2003, 07:46 AM
What DirectX version?

Hi, thanks for replying!

DX7

Clootie
11-06-2003, 07:58 AM
In DirectDraw7/Direct3D7:

[background=#FFFFFF][normal=#000000][number=#0000FF][string=#0000FF][comment=#248F24][reserved=#000000](1) at init time:
if (ddObject.CreateClipper(0, @ddClipper, NULL) = DD_OK) then
ddClipper.SetHWnd(0, hwndAppWindow);
ddObject.FlipToGDISurface;

(2) later
ddFrontBuffer.SetClipper(ddClipper);
ddFrontBuffer.Blt(NULL, ddBackBuffer, NULL, DDBLT_WAIT, NULL);
// or Flip
ddObject.FlipToGDISurface;

Gadget
11-06-2003, 09:37 AM
In DirectDraw7/Direct3D7:

[background=#FFFFFF][normal=#000000][number=#0000FF][string=#0000FF][comment=#248F24][reserved=#000000](1) at init time:
if (ddObject.CreateClipper(0, @ddClipper, NULL) = DD_OK) then
ddClipper.SetHWnd(0, hwndAppWindow);
ddObject.FlipToGDISurface;

(2) later
ddFrontBuffer.SetClipper(ddClipper);
ddFrontBuffer.Blt(NULL, ddBackBuffer, NULL, DDBLT_WAIT, NULL);
// or Flip
ddObject.FlipToGDISurface;

Thanks for the quick reply again, but I am using fullscreen mode!

Clootie
11-06-2003, 12:21 PM
You mean you need this?
surface.Flip();
DDraw.FlipToGDISurface;

Gadget
13-06-2003, 03:05 PM
You mean you need this?
surface.Flip();
DDraw.FlipToGDISurface;

Thanks, but what I really wanted was some miracle way of getting forms to paint to DirectX surfaces! I think without a lot of coding it isn't going to happen. I played around with FlipToGDISurface already, it's very very slow to the point it may as well not be used.

Clootie
13-06-2003, 08:50 PM
I have not played with DirectX7 for some time, but FlipToGDISurface should not be slow. And you need to do only two things: attach Clipper and use FlipToGDISurface - I thinks it's not too much for miracle?
At least DirectX9 fullscreen sample I've provided for another thread here do show good performance.

Gadget
16-06-2003, 10:32 AM
I have not played with DirectX7 for some time, but FlipToGDISurface should not be slow. And you need to do only two things: attach Clipper and use FlipToGDISurface - I thinks it's not too much for miracle?
At least DirectX9 fullscreen sample I've provided for another thread here do show good performance.

WOW, I didn't think that would work! I will give it a go and post my progress. Thanks a lot for being patient, I am still learning and very much appreciate your time and effort.

Gadget
19-06-2003, 12:27 PM
I ended up using PaintTo, and that worked a treat with no FPS loss. :)