HighTechTalks DotNet Forums  

Drawing Performance

Dotnet Framework (Drawing) microsoft.public.dotnet.framework.drawing


Discuss Drawing Performance in the Dotnet Framework (Drawing) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Mehmet Ozyurt
 
Posts: n/a

Default Drawing Performance - 06-29-2003 , 05:09 AM







I am a maths teacher and I want to make java-applet like math applets in
win32 platform. I studied GDI+ in VB.Net. My problem is:

For example, I want to move a line by dragging with mouse or I want to
animate some sine or cosine curves. When I animate or move,
I must clear the previous lines or shapes, and it flickers. How can I
overcome this problem and obtain smooth better profesional
animations?

Can someone please help me?


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Reply With Quote
  #2  
Old   
Ken Tucker
 
Posts: n/a

Default Re: Drawing Performance - 06-29-2003 , 07:39 AM






Hi,

Draw on a bitmap then draw the bitmap on the screen.

Ken
------------
"Mehmet Ozyurt" <anonymous (AT) devdex (DOT) com> wrote

Quote:
I am a maths teacher and I want to make java-applet like math applets in
win32 platform. I studied GDI+ in VB.Net. My problem is:

For example, I want to move a line by dragging with mouse or I want to
animate some sine or cosine curves. When I animate or move,
I must clear the previous lines or shapes, and it flickers. How can I
overcome this problem and obtain smooth better profesional
animations?

Can someone please help me?


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Reply With Quote
  #3  
Old   
Bob Powell [MVP]
 
Posts: n/a

Default Re: Drawing Performance - 06-29-2003 , 07:46 AM



Flickering can be killed by using double buffering.

Windows Forms applications and controls can set a style bit that enables
automatic double buffering.

See my 8th June post entitled "Aniamtion in GDI+ with double buffering" for
full details and a demo application.

--
Bob Powell [MVP]
C#, System.Drawing

Check out the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Buy quality Windows Forms tools
http://www.bobpowell.net/xray_tools.htm

Get the NEW must-have UI component. The .NET RectTracker
Enables CRectTracker like functionality for WindowsForms.
User defined layouts are a breeze.
http://www.bobpowell.net/recttracker.htm

"Mehmet Ozyurt" <anonymous (AT) devdex (DOT) com> wrote

Quote:
I am a maths teacher and I want to make java-applet like math applets in
win32 platform. I studied GDI+ in VB.Net. My problem is:

For example, I want to move a line by dragging with mouse or I want to
animate some sine or cosine curves. When I animate or move,
I must clear the previous lines or shapes, and it flickers. How can I
overcome this problem and obtain smooth better profesional
animations?

Can someone please help me?


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Reply With Quote
  #4  
Old   
performer24
 
Posts: n/a

Default Re: Drawing Performance - 06-30-2003 , 05:21 AM



Hi All,

Bob, I appreciate Your ideas of using double-buffering, however, to my
knowledge it does not solve perfomance problem as it lies in lack of
hardware support in GDI+. Because of that one would encounter tremendous
slowdowns in double-buffering mode while using GDI+ (there are few posts on
that problem here). That's why I moved to DirectX, and to my knowledge you
use it as well to get up to speed (your other posts here and there).
Obviously I would not recommend for begginners to do that, however, some
experience with programming should be sufficient to cope with DirectDraw
namespace classess and functions.

I have not tested Ken idea of using bitmap as a drawing target but its
tempting one - has anyone compared perfomance of this technique to DirectX -
10 fold penalty would be fine for many apps.

performer24


Użytkownik "Bob Powell [MVP]" <bob (AT) _spamkiller_bobpowell (DOT) net> napisał w
wiadomości news:elK7AQjPDHA.1720 (AT) TK2MSFTNGP11 (DOT) phx.gbl...
Quote:
Flickering can be killed by using double buffering.

Windows Forms applications and controls can set a style bit that enables
automatic double buffering.

See my 8th June post entitled "Aniamtion in GDI+ with double buffering"
for
full details and a demo application.

--
Bob Powell [MVP]
C#, System.Drawing

Check out the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Buy quality Windows Forms tools
http://www.bobpowell.net/xray_tools.htm

Get the NEW must-have UI component. The .NET RectTracker
Enables CRectTracker like functionality for WindowsForms.
User defined layouts are a breeze.
http://www.bobpowell.net/recttracker.htm

"Mehmet Ozyurt" <anonymous (AT) devdex (DOT) com> wrote in message
news:#Sk9g4hPDHA.3664 (AT) tk2msftngp13 (DOT) phx.gbl...

I am a maths teacher and I want to make java-applet like math applets in
win32 platform. I studied GDI+ in VB.Net. My problem is:

For example, I want to move a line by dragging with mouse or I want to
animate some sine or cosine curves. When I animate or move,
I must clear the previous lines or shapes, and it flickers. How can I
overcome this problem and obtain smooth better profesional
animations?

Can someone please help me?


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!





Reply With Quote
  #5  
Old   
Bob Powell [MVP]
 
Posts: n/a

Default Re: Drawing Performance - 07-02-2003 , 07:01 AM



Hello,

You're right to say that double buffering reduces the performance of an
application and in this case, the use of double buffering is specifically to
reduce an annoying flicker.

I have indeed used DirectX to good effect in conjunction with Windows Forms,
specifically to increase blitting performance. DirectX blits are 10-20 times
faster than GDI+ blits under certain circumstances. The ideal situation for
using DX blitting is when you have to blit without stretching. Whenever the
source and destination rectangles are different sizes, DirectX seems to be
even slower than GDI+, at least on my machine.

Unfortunately, there are some serious bugs in the framework wrappers for
both DirectX and GDI+ that really mess up a graphics programmers life. Bug 1
is the inability of the DirectDraw Surface to lock the image array
correctly. This means that some routines that directly manupulate the bitmap
data are not possible under .NET. Bug 2 is in the Region.GetRegionScans
method which means that it's not possible to use a GDI+ region for clipping
a DirectDraw surface.

I figure that if I do my off screen drawing at the speed of GDI+ and then
blit the final image to the screen in 1/20th of the time, thats still a
pretty good performance increase.


--
Bob Powell [MVP]
C#, System.Drawing

Check out the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Buy quality Windows Forms tools
http://www.bobpowell.net/xray_tools.htm

Get the NEW must-have UI component. The .NET RectTracker
Enables CRectTracker like functionality for WindowsForms.
User defined layouts are a breeze.
http://www.bobpowell.net/recttracker.htm

"performer24" <performer24 (AT) konto (DOT) pl> wrote

Quote:
Hi All,

Bob, I appreciate Your ideas of using double-buffering, however, to my
knowledge it does not solve perfomance problem as it lies in lack of
hardware support in GDI+. Because of that one would encounter tremendous
slowdowns in double-buffering mode while using GDI+ (there are few posts
on
that problem here). That's why I moved to DirectX, and to my knowledge you
use it as well to get up to speed (your other posts here and there).
Obviously I would not recommend for begginners to do that, however, some
experience with programming should be sufficient to cope with DirectDraw
namespace classess and functions.

I have not tested Ken idea of using bitmap as a drawing target but its
tempting one - has anyone compared perfomance of this technique to
DirectX -
10 fold penalty would be fine for many apps.

performer24


Użytkownik "Bob Powell [MVP]" <bob (AT) _spamkiller_bobpowell (DOT) net> napisał w
wiadomości news:elK7AQjPDHA.1720 (AT) TK2MSFTNGP11 (DOT) phx.gbl...
Flickering can be killed by using double buffering.

Windows Forms applications and controls can set a style bit that enables
automatic double buffering.

See my 8th June post entitled "Aniamtion in GDI+ with double buffering"
for
full details and a demo application.

--
Bob Powell [MVP]
C#, System.Drawing

Check out the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Buy quality Windows Forms tools
http://www.bobpowell.net/xray_tools.htm

Get the NEW must-have UI component. The .NET RectTracker
Enables CRectTracker like functionality for WindowsForms.
User defined layouts are a breeze.
http://www.bobpowell.net/recttracker.htm

"Mehmet Ozyurt" <anonymous (AT) devdex (DOT) com> wrote in message
news:#Sk9g4hPDHA.3664 (AT) tk2msftngp13 (DOT) phx.gbl...

I am a maths teacher and I want to make java-applet like math applets
in
win32 platform. I studied GDI+ in VB.Net. My problem is:

For example, I want to move a line by dragging with mouse or I want to
animate some sine or cosine curves. When I animate or move,
I must clear the previous lines or shapes, and it flickers. How can I
overcome this problem and obtain smooth better profesional
animations?

Can someone please help me?


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!







Reply With Quote
  #6  
Old   
Margie Cowen
 
Posts: n/a

Default Re: Drawing Performance - 07-02-2003 , 11:28 AM



We discussed performance issues with GDI blits a couple weeks ago. Would
anyone be kind enough to point me in the correct direction for obtaining a
screen capture using DirectX 9 (directdraw i'm guessing) with the .NET
DirectX assemblies? I've searched (perhaps not for the correct terms) and
haven't found an example and description of how to do this.

Thx

"Bob Powell [MVP]" <bob (AT) _spamkiller_bobpowell (DOT) net> wrote

Quote:
Hello,

You're right to say that double buffering reduces the performance of an
application and in this case, the use of double buffering is specifically
to
reduce an annoying flicker.

I have indeed used DirectX to good effect in conjunction with Windows
Forms,
specifically to increase blitting performance. DirectX blits are 10-20
times
faster than GDI+ blits under certain circumstances. The ideal situation
for
using DX blitting is when you have to blit without stretching. Whenever
the
source and destination rectangles are different sizes, DirectX seems to be
even slower than GDI+, at least on my machine.

Unfortunately, there are some serious bugs in the framework wrappers for
both DirectX and GDI+ that really mess up a graphics programmers life. Bug
1
is the inability of the DirectDraw Surface to lock the image array
correctly. This means that some routines that directly manupulate the
bitmap
data are not possible under .NET. Bug 2 is in the Region.GetRegionScans
method which means that it's not possible to use a GDI+ region for
clipping
a DirectDraw surface.

I figure that if I do my off screen drawing at the speed of GDI+ and then
blit the final image to the screen in 1/20th of the time, thats still a
pretty good performance increase.



Reply With Quote
  #7  
Old   
Margie Cowen
 
Posts: n/a

Default Re: Drawing Performance - 07-03-2003 , 09:15 AM



I had no idea that group was for .NET and DirectX. Maybe Microsoft should
change the name of the group to be more consistent with the other groups.
All the other .NET groups have "dotnet" in the name.


"Bob Powell [MVP]" <bob (AT) _spamkiller_bobpowell (DOT) net> wrote

Quote:
Hi Marjie,

I would suggest asking this question over in the
microsoft.public.win32.directx.managed group.

--



Reply With Quote
  #8  
Old   
Jon Rista
 
Posts: n/a

Default `Re: Drawing Performance - 07-05-2003 , 01:29 AM



I just wanted to chime in here and mention something. While double buffering
in GDI+ does slow things down, I came accross one interesting little fluke
recently. I've been working on an application to edit and create a type of
image called an FSH, used in Electronic Arts games like Need For Speed and
Sim City 4. I feature I've been working on in this application is the
ability to slice up large images into 256x256 chunks. I am doing a lot of
alpha-mapped overlay drawing, which shows the position and size of the
slices on the original, larger image.

Initially, I was not double buffering, and rendering alpha-mapped overlays
was EXTREMELY slow...visibly slow...dog slow even. I enabled
double-buffering, and the performance improvement was astounding, faster
than before without any of the alpha-mapped stuff.

For non-alpha drawing routeens, double-buffering does incurr a performance
hit, but when you filter in alpha to the equation, it seems that
double-buffering offers a significant improvement.

Jon Rista

"Bob Powell [MVP]" <bob (AT) _spamkiller_bobpowell (DOT) net> wrote

Quote:
Hello,

You're right to say that double buffering reduces the performance of an
application and in this case, the use of double buffering is specifically
to
reduce an annoying flicker.

I have indeed used DirectX to good effect in conjunction with Windows
Forms,
specifically to increase blitting performance. DirectX blits are 10-20
times
faster than GDI+ blits under certain circumstances. The ideal situation
for
using DX blitting is when you have to blit without stretching. Whenever
the
source and destination rectangles are different sizes, DirectX seems to be
even slower than GDI+, at least on my machine.

Unfortunately, there are some serious bugs in the framework wrappers for
both DirectX and GDI+ that really mess up a graphics programmers life. Bug
1
is the inability of the DirectDraw Surface to lock the image array
correctly. This means that some routines that directly manupulate the
bitmap
data are not possible under .NET. Bug 2 is in the Region.GetRegionScans
method which means that it's not possible to use a GDI+ region for
clipping
a DirectDraw surface.

I figure that if I do my off screen drawing at the speed of GDI+ and then
blit the final image to the screen in 1/20th of the time, thats still a
pretty good performance increase.


--
Bob Powell [MVP]
C#, System.Drawing

Check out the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Buy quality Windows Forms tools
http://www.bobpowell.net/xray_tools.htm

Get the NEW must-have UI component. The .NET RectTracker
Enables CRectTracker like functionality for WindowsForms.
User defined layouts are a breeze.
http://www.bobpowell.net/recttracker.htm

"performer24" <performer24 (AT) konto (DOT) pl> wrote in message
news:uF2SUtHQDHA.2700 (AT) tk2msftngp13 (DOT) phx.gbl...
Hi All,

Bob, I appreciate Your ideas of using double-buffering, however, to my
knowledge it does not solve perfomance problem as it lies in lack of
hardware support in GDI+. Because of that one would encounter tremendous
slowdowns in double-buffering mode while using GDI+ (there are few posts
on
that problem here). That's why I moved to DirectX, and to my knowledge
you
use it as well to get up to speed (your other posts here and there).
Obviously I would not recommend for begginners to do that, however, some
experience with programming should be sufficient to cope with DirectDraw
namespace classess and functions.

I have not tested Ken idea of using bitmap as a drawing target but its
tempting one - has anyone compared perfomance of this technique to
DirectX -
10 fold penalty would be fine for many apps.

performer24


Użytkownik "Bob Powell [MVP]" <bob (AT) _spamkiller_bobpowell (DOT) net> napisał w
wiadomości news:elK7AQjPDHA.1720 (AT) TK2MSFTNGP11 (DOT) phx.gbl...
Flickering can be killed by using double buffering.

Windows Forms applications and controls can set a style bit that
enables
automatic double buffering.

See my 8th June post entitled "Aniamtion in GDI+ with double
buffering"
for
full details and a demo application.

--
Bob Powell [MVP]
C#, System.Drawing

Check out the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Buy quality Windows Forms tools
http://www.bobpowell.net/xray_tools.htm

Get the NEW must-have UI component. The .NET RectTracker
Enables CRectTracker like functionality for WindowsForms.
User defined layouts are a breeze.
http://www.bobpowell.net/recttracker.htm

"Mehmet Ozyurt" <anonymous (AT) devdex (DOT) com> wrote in message
news:#Sk9g4hPDHA.3664 (AT) tk2msftngp13 (DOT) phx.gbl...

I am a maths teacher and I want to make java-applet like math
applets
in
win32 platform. I studied GDI+ in VB.Net. My problem is:

For example, I want to move a line by dragging with mouse or I want
to
animate some sine or cosine curves. When I animate or move,
I must clear the previous lines or shapes, and it flickers. How can
I
overcome this problem and obtain smooth better profesional
animations?

Can someone please help me?


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!









Reply With Quote
  #9  
Old   
Ozyurt
 
Posts: n/a

Default Re: Drawing Performance - 07-07-2003 , 03:03 AM



Thanks for your help. Drawing on a bitmap and then
drawing on the screen worked great for my application.
Animations are faster and smooth and there are no more
flickers.

Quote:
-----Original Message-----
Hi,

Draw on a bitmap then draw the bitmap on the
screen.

Ken
------------
"Mehmet Ozyurt" <anonymous (AT) devdex (DOT) com> wrote in message
news:%23Sk9g4hPDHA.3664 (AT) tk2msftngp13 (DOT) phx.gbl...

I am a maths teacher and I want to make java-applet
like math applets in
win32 platform. I studied GDI+ in VB.Net. My problem
is:

For example, I want to move a line by dragging with
mouse or I want to
animate some sine or cosine curves. When I animate or
move,
I must clear the previous lines or shapes, and it
flickers. How can I
overcome this problem and obtain smooth better
profesional
animations?

Can someone please help me?


*** Sent via Developersdex
http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


.


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.