Re: How to do some GDI on top of Direct3D

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Disregard this message. I've already resolved the problem.
Using Direct3D + GDI in a window and several transparent GDI controls on top
of it is working without any problem. .NET Compact Framework is great!


"Robert Janik" <robert_janik@xxxxxxxxxxx> wrote in message
news:OZxw5dWBHHA.3928@xxxxxxxxxxxxxxxxxxxxxxx
Hi,

Does anybody have experience with GDI on top of Direct3D on Pocket PC?
I need to render 3D scene and after that do some GDI drawing, but it
flickers. Currently I'm using GDI to draw into a bitmap, I'm using
ImageAttributes to set transparent color and when I finish drawing I draw
bitmap to the graphics.

Example:

device.BeginScene();
...
device.EndScene();
device.Present();

graphics.DrawString(.....); // graphics is created by
Graphics.FromImage(bitmap)
...
e.Graphics.DrawImage(bitmap, this.ClientRectangle, 0, 0,
this.ClientSize.Width, this.ClientSize.Height, GraphicsUnit.Pixel,
imageAttr);


It is fast, but there is still flickering. I tried to use GetBackBuffer
and
do the drawing before calling Present, but I'm unable to get graphics, it
throws an exception

device.BeginScene();
...
device.EndScene();

Surface frontSurface = device.GetBackBuffer(0, BackBufferType.Mono);
graphics = frontSurface.GetGraphics();
// InvalidCallException at CDirect3DMobileSurface.GetDC()
frontSurface.ReleaseGraphics();
frontSurface.Dispose();

device.Present();


Does anybody know why I'm able to get backbuffer but not graphics by
calling
Surface.GetGraphics() ?
I know that I could use Sprite to render bitmap, but I would prefer to
access BackBuffer and draw directly into it.

Thanks for any help,
Robert





.



Relevant Pages

  • XPe Graphics Performance
    ... CT69000 graphics controller. ... I am evaluating the performance of .NET graphics and the CPU load is ... found information that states that both XP and .NET use GDI+ and not ... CT69000 graphics controller does not support Direct3D. ...
    (microsoft.public.windowsxp.embedded)
  • Re: Windows XP Only
    ... 2D graphics than GDI. ... Direct3D also allows advanced techniquies like ... For a game with relatively simple graphics requirements like the ... why you never saw any 2D RTS games use GDI. ...
    (comp.sys.ibm.pc.games.strategic)
  • Re: Initializing Direct3D in a web application
    ... Thanks, i want to use Direct3D instead of GDI+ just because, i have large experience with 3D graphics, but GDI+ it's new for me yet ... It's very difficult to represent charts with visual effects, like perspective, lighting and etc. using standard GDI+ functionality ...
    (microsoft.public.win32.programmer.directx.graphics)
  • The story: Painting bitmap to screen is slow
    ... I've done a lot graphics programming by now and the thing that bothers me with GDI+ in .NET framework the most is slow drawing of bitmaps to screen. ... In Win32, there were two types of bitmaps, compatible and memory bitmap. ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: regarding graphics object
    ... The GDI+ FAQ shows how to create retained mode graphics systems but notice ... that these still paint all the visible objects at each Paint cycle. ... Find great Windows Forms articles in Windows Forms Tips and Tricks ...
    (microsoft.public.dotnet.framework.drawing)