Xtreme Visual Basic Talk

Xtreme Visual Basic Talk (http://www.xtremevbtalk.com/)
-   .NET Game Programming (http://www.xtremevbtalk.com/-net-game-programming/)
-   -   Ways to speed up drawing? (http://www.xtremevbtalk.com/-net-game-programming/326036-speed-drawing.html)

pampam686 06-09-2013 04:21 AM

Ways to speed up drawing?
what are the common practices/techniques to speed up drawing GDI?

can you paint in multiple threads?

i am running at 1920 x1080 resolution and drawing images of these sizes give me a max fps of 24-25. help. thnx

passel 06-10-2013 11:31 AM

Of course a standard answer would be not to use GDI+ since it isn't meant for rapid game type drawing, but if you want to speed up GDI+ the answers can be quite involved and subjective.
My personal testing of GDI+ methods of drawing have led me to conclude that using texture brushes and the BufferedGraphics class gave the best boost to sprite type, i.e. arcade style games within the limits of GDI+.
On the other hand, if you were doing a lot of pixel manipulation, such as a paint application, or computer aided design (cad), or simulating fireworks, or fractals, etc... processing pixels values in a memory array and rendering from there would probably be the quickest approach.
As for your second question, I did do some experiments with two threads rendering a number of items in two different backbuffers, but found that total number of items that could be rendered per second did not go up. It appears that even if two thread are using two different graphic objects to write into two different backbuffers, that the GDI+ calls themselves might be serialized to some extent, at least within a given process, so that the net result was the same or less than doing all the rendering in one thread. I assume that if you had a large amount of calculation to be done in relation to the drawing, then there could be a substantial gain with those two tasks being separated into two threads.
One series of experiments with GDI+ drawing can be found in the first 12 posts of this thread.
It starts off fairly traditionally, drawing from the Paint event, but quickly moves to using the BufferedGraphics object and texture brushes to increase drawing speed, and backbuffer "flipping" speed.

ephestion 07-16-2013 12:38 PM

The only thing that slows down VB .Net from what I seem to observe is somekind of bottleneck based on the VB.Net system. A very large loop or several conditionals can slow down code considerably.

A Loop in C (non .Net) is many times faster than Visual C++ or C# and especially better than VB.Net.The actual drawing component of the system.Graphics object is a low level API Wrapper. VB.Net works well with API or in built managed code. The only problem I have noticed is that even if the underlying code be it API or Managed COde, th eend result is that VB.Net is slawer

All times are GMT -6. The time now is 08:29 AM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Search Engine Optimisation provided by DragonByte SEO v2.0.15 (Lite) - vBulletin Mods & Addons Copyright © 2018 DragonByte Technologies Ltd.
All site content is protected by the Digital Millenium Act of 1998. Copyright©2001-2011 MAS Media Inc. and Extreme Visual Basic Forum. All rights reserved.
You may not copy or reproduce any portion of this site without written consent.