Jump to content
Sign in to follow this  
Guest fturner

GDI+ Alternative - C++ Gauge

Recommended Posts

Guest fturner

Hi folks,I was going through my hard drive tonight cleaning stuff up and I came across a project I was playing with end of last year/beginning of this year.Basically, its an alternative to drawing "vector" gauges other than GDI+, and from the trials I was doing.... it is WAY smoother, WAY faster, and VERY crisp... even in the virtual cockpit.Its called Anti-Grain Geometry, and believe it or not, FSX is actually using a modified version to draw 2d objects.Here's the website to there http://www.antigrain.comAnd here's a link to a VS2003 gauge example I've created that also builds up the fonts as well http://www.cfstudios.com/files/airbus.zipHope you enjoy this and feel free to message me if you have any questions. Also, you can post questions etc under the developers forum at http://www.cfstudios.com/forumAll in all, I ask that you give credit where its do when using any of the work provided by anyone else. Of course we all know that some commercial folks won't but thats just the nature of the beast I guess.Have fun.Frit

Share this post


Link to post
Share on other sites

Hello Frit,I know AGG, I also had a look at it as an alternative to GDI+. IMO, the documentation is quite bad, and it makes the library very difficult to understand. This is why I gave up because I had no much time to spend on this...Compared to this, GDI+ is very well documented by Microsoft and is very easy to understand.I will have a look at your sample and at the forum you're pointing, hoping it will help me in understanding better this great library, which indeed looks faster than GDI+. BTW, don't you think the AGG rendering looks very similar to Reality XP? Interesting... Eric

Share this post


Link to post
Share on other sites
Guest fturner

It took a bit to get to understand how it works, but I found the demos you get with it to be very helpful.Also to note, I needed to make a change to the concat function in AGG 2.4 to make things a little easier to build display lists so to speak. Its in the file agg_path_storage.h in the inc folder and I've marked it with FWT:. I don't have any of realityxp's stuff, but I have been told by others that do, that the AGG produced screen are at least as smooth as their stuff. I know I've done timing on how long it takes for agg to produce a full CRT screen worth of information like the SD on an airbus and the measured time to render was so small it barely registered.Once you get the hang of how agg works, its a breeze and I actually found it easier to do than GDI+.Frit

Share this post


Link to post
Share on other sites

I didn't look very deepply into AGG, and I hope I will have the time to do it, but I have been looking for a clipping function and I couldn't find any. Do you know if it exists? Maybe I didn't search enough...Thanks,Eric

Share this post


Link to post
Share on other sites
Guest fturner

The built in clipping in AGG only uses a rectangle, but another person has added functions into AGG to do fancier clippings, but I don't think its free for commercial use.To by pass it, I've actually built several planes up then blitted the layers together as my example shows a basic way of doing that as well.Frit

Share this post


Link to post
Share on other sites

I find the AGG rendering to be rather anorexic in appearance to be honest. It tends to overdo the anti-alias to the point where thin lines are practically transparent.


Ed Wilson

Mindstar Aviation
My Playland - I69

Share this post


Link to post
Share on other sites
Guest mgipson

I tried it a while ago and found that the quality wasn't much better than GDI+ and it was only slightly faster. Perhaps I was doing something wrong? The font support was poor as well.

Share this post


Link to post
Share on other sites
Guest fturner

>I find the AGG rendering to be rather anorexic in appearance>to be honest. It tends to overdo the anti-alias to the point>where thin lines are practically transparent.I had that problem at first but once I started setting the line thickness to 1.5 and/or offset the line by 0.5 pixels that cured the problem, and I was able to get very fine lines that where very crisp.Frit

Share this post


Link to post
Share on other sites

Thanks. We've had a gauge programmer looking deeply at AG for many months. I'll make sure he sees your example! ;)


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites
Guest Patrick_Waugh

Yeah, I looded at this too, but frankly don't really see the cost/benefit trade-off compared to GDI+ in terms of learning curve vs. performance. I think the key is just proper programming, whatever API you use. Using GDI+ for the sim itself would be to slow, but for gauges, I think this is a bit of 'overoptimization' at work really.

Share this post


Link to post
Share on other sites
Guest fturner

Not to be a stickler in the mud, but having such a negative attitude towards something new is not gonna get you anywhere.I have done the testing.. ie did the entire gauge in GDI+ and also generated the entire gauge using AGG and there is a HUGE difference in performance. We are talking milliseconds difference between them.... in fact, I even coded alot of the gdi+ gauge in assembler to try to improve its performance over AGG and despite shaving off a few milliseconds, it could not do it.Also, one thing that GDI+ will never be able to do is sub pixel processing.... at least to the level AGG can. There is no way you will ever get a GDI+ gauge to be liquid smooth as AGG can be because GDI+ just doesn't have the subpixel accuracy...Frit

Share this post


Link to post
Share on other sites
Guest JeanLuc_

Hi Eric!well, from French to French, je comprends l'insinuation, mais pas de lezard, TDXP et AAG sont bien deux choses differentes ;-)Back in english, AAG is WAY faster than GDI+ and TDXP is even WAY faster than AAG. Unfortunately, AAG licensing aggreement prevents commercial use for the most part.AAG also provides a Liang Barsky clipping. You will find this interresting although there are many web sites about this. TDXP uses a faster approach for viewports, and a near no-cost approach for the entire drawing surface.Hope this helps!

Share this post


Link to post
Share on other sites
Guest fturner

>Hi Eric!>>well, from French to French, je comprends l'insinuation, mais>pas de lezard, TDXP et AAG sont bien deux choses differentes>;-)>>Back in english, AAG is WAY faster than GDI+ and TDXP is even>WAY faster than AAG. Unfortunately, AAG licensing aggreement>prevents commercial use for the most part.>>AAG also provides a Liang Barsky clipping. You will find this>interresting although there are many web sites about this.>TDXP uses a faster approach for viewports, and a near no-cost>approach for the entire drawing surface.>>Hope this helps!>>>Actually, I think you need to re-read the license on AGG..... it CAN be used for commercial use with no payments. Its the enhanced clipping system that needs to be negotiated.After trial runs with several people who tried Agg to realityXP stuff, AGG won hands down in the VC.Sheesh, why am I defending this LOL! I know for my commercial projects I will be using AGG, as its the only "free" system out there ;).Frit

Share this post


Link to post
Share on other sites
Guest JeanLuc_

just read the license again, and my memory is aging! you are right and this is a good to go. I was wrong."After trial runs with several people who tried Agg to realityXP stuff, AGG won hands down in the VC."You got my attention! I really wonder what you refer to "win"? with what Reality XP product do you compare and under what comparision context?By the way, TDXP is being ported to a standalone DLL now with a documented API. With the latest build, DRAWING and BLITTING a 500x500 bitmap with a reasonably complex rendering (nearly twice as complex as the Jet Line 4 PFD in terms of clipping/number of elements drawn) takes roughly 4.2ns per pixel on average on a Core Duo 2Ghz (and roughyl 4.8ns per pixel on average on a P4 2.8Ghz.Let me know what you get with AAG. I may scrap all to the trashcan and use it instead if it is indeed faster.Please help!

Share this post


Link to post
Share on other sites
Guest Patrick_Waugh

I hear you, I'm just saying that IMHO, the benefits are not going to be all that noticable, compared to the level of effort required. I mean, once you resize that gauge down to 41x41 pixels, you aren't going to see the difference. Now for something bigger then maybe so for some special effect.I think it's awesome that you have learned it. Actually, I hope they develop it more. I may use it in a game program.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...