473,385 Members | 1,912 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

c# and GDI graphics

Hi

I had an app i write on DirectX that will nearly always run in a windowed
situation. It could also have many instances running at a time and as such
to keep the cpu usage down i had a frame refresh sticker ever 32 ms rather
than maximum speed. This worked great but then i thought as all my graphics
are 2D this is huge over kill.

So i decided to port it to GDI graphics. At first a good idea i could easily
do everything i was using with Directx but less end requirements for the
user and much smaller code and less 'set up' code.

However first i found severe flicker with the GDI solution. So i implemented
a double buffer which solved the flicker but all my transparent imagery was
lost (due to the doubling up). I found if i clear the back buffer to prevent
doubling up i get a flicker again.

this all aside a even bigger problem, my cpu usage is FAR worse than it was
with directx. With a refresh every second it still spikes to 18% for one
instance. I have seen rival products on the market use simple graphics who
keep the cpu under 5% when i had 10 instances open.

What am i doing wrong? Is it possible to make an efficient GDI app?

Sep 15 '06 #1
1 2000
Daniel,

It is possible, but the one main advantage that the DirectX solution has
over the GDI app is that DirectX is going to utilize hardware acceleration
when it can, whereas GDI won't (you are simply pushing pixels to the screen
there, very low level).

If your requirements and your development permit (XP/2003 and above,
don't mind using the .NET 3.0 framework which is not even in beta yet), you
might want to try using the Windows Presentation Foundation. It will give
you the benefits of hardware acceleration (it utilizes DX underneath the
covers) and an easy programming model.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Daniel" <Da*****@vestryonline.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
Hi

I had an app i write on DirectX that will nearly always run in a windowed
situation. It could also have many instances running at a time and as such
to keep the cpu usage down i had a frame refresh sticker ever 32 ms rather
than maximum speed. This worked great but then i thought as all my
graphics are 2D this is huge over kill.

So i decided to port it to GDI graphics. At first a good idea i could
easily do everything i was using with Directx but less end requirements
for the user and much smaller code and less 'set up' code.

However first i found severe flicker with the GDI solution. So i
implemented a double buffer which solved the flicker but all my
transparent imagery was lost (due to the doubling up). I found if i clear
the back buffer to prevent doubling up i get a flicker again.

this all aside a even bigger problem, my cpu usage is FAR worse than it
was with directx. With a refresh every second it still spikes to 18% for
one instance. I have seen rival products on the market use simple graphics
who keep the cpu under 5% when i had 10 instances open.

What am i doing wrong? Is it possible to make an efficient GDI app?

Sep 15 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: JBiagio | last post by:
Hello All, I am attempting to learn a bit about the GDI+ transforms and charting data and I feel like I'm getting a handle on how the transforms work. My chart object has a large "canvas" bitmap...
12
by: Sanjay | last post by:
hi, We are currently porting our project from VB6 to VB .NET. Earlier we used to make scale transformations on objects like pictureBox , forms etc.Now Such transformations are made on the...
2
by: John Bailo | last post by:
I am walking through some of the very first sample code from the book "Beginning .NET Game Programming" from Apress. I identify his sample code with //SC This code puzzles me: Graphics graph...
14
by: Pmb | last post by:
At the moment I'm using Borland's C++ (http://www.borland.com/products/downloads/download_cbuilder.html#) I want to be able to take an array of points and plot them on the screen. Is there a way...
5
by: Charles A. Lackman | last post by:
Hello, I have created a complete PrintDocument and need to create an image from it. How is this done? e.Graphics.SmoothingMode = Drawing2D.SmoothingMode.HighQuality...
6
by: Chris Dunaway | last post by:
The method for printing documents in .Net can be confusing, especially for newer users. I would like to create a way to simplify this process. My idea would be implemented using a PrintDocument...
12
by: Xah Lee | last post by:
Of Interest: Introduction to 3D Graphics Programing http://xahlee.org/3d/index.html Currently, this introduction introduces you to the graphics format of Mathematica, and two Java Applet...
6
by: active | last post by:
I have an image and a graphics object created (FromImage) from that image. I need to create a new image and create a new graphics object from the new image. I want the new graphics object have...
9
by: DaveL | last post by:
hello I have a Bit map 1367 wide 32 high this bitmap contains like 40 separate Images 32x32 I tell it the id*32 to get the approiate Image from the source Bitmap When i CreateGraphics()...
8
by: Abhiraj Chauhan | last post by:
I need someone to make an example of how to create a graphics window in VB.net 2008. I understand the basics of how to draw a rectangle and lines etc. What I need is an example of how to make a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.