Is Xojo capable of fast graphics manipulation

Hello,

I was just wondering if Xojo is capable of high performance demanding graphics manipulation. To expand upon that, I mean using no external plugins. Can OpenGL help make complex and demanding graphic algorithms run quickly. Is a language like C++ really needed to do this?

I wanted to know because my graphics manipulation code is, although has a very simple algorithm which I would imagine be calculated by the computer very quickly, the performance is not great with large images because scaling images is slow with Xojo’s built-in DrawPicture function.

Thanks

Yes it is. Just look at Shine by Ohanaware. It really comes down to your code and optimizations.

Thank you. This is the answer I wanted hear!! So they did not use C++ plugins or OpenGL?

You’d have to ask Sam Rowlands – he does use a lot of system calls, having OS X do a lot of things for him. He might have used some to speed things up.

[quote=73343:@Oliver Scott-Brown]I was just wondering if Xojo is capable of high performance demanding graphics manipulation. To expand upon that, I mean using no external plugins. Can OpenGL help make complex and demanding graphic algorithms run quickly. Is a language like C++ really needed to do this?
[/quote]

If you want to implement an algorithm that calculates things pixel by pixel, a smartly hand-optimized implementation in C/C++ (as a plugin presumably, but you could declare into a library you write as well) will smoke the best you can achieve with Xojo only. The predominant reason comes down to pointer caching as you scan rows.

OpenGL and system graphics kits have very rich sets of graphic manipulation functions. You can assume a level of optimization in these that’s probably adequate for most of the functions and isn’t going to be exceeded at low cost. If you come up with some new effect that can’t be done by combining operations in your graphics kits, you’ll have to hand-code them somewhere, calculating results pixel by pixel. I typically code up working prototypes in Xojo and then implement in C++ as a plugin function when I get my head around the general concept via the prototype.

Ouch, I like things to be cross platform. Thanks

[quote=73358:@Brad Hutchings]If you want to implement an algorithm that calculates things pixel by pixel, a smartly hand-optimized implementation in C/C++ (as a plugin presumably, but you could declare into a library you write as well) will smoke the best you can achieve with Xojo only. The predominant reason comes down to pointer caching as you scan rows.

OpenGL and system graphics kits have very rich sets of graphic manipulation functions. You can assume a level of optimization in these that’s probably adequate for most of the functions and isn’t going to be exceeded at low cost. If you come up with some new effect that can’t be done by combining operations in your graphics kits, you’ll have to hand-code them somewhere, calculating results pixel by pixel. I typically code up working prototypes in Xojo and then implement in C++ as a plugin function when I get my head around the general concept via the prototype.[/quote]
Thanks. I have never really coded in C++ before.

[quote=73361:@Oliver Scott-Brown]Thanks. I have never really coded in C++ before.
[/quote]

Most would be busy learning it and whatever IDE they want to use for several months before they were ready to tackle a Xojo plugin. While the graphics algorithms are pretty straightforward at a high level – scan the rows, compute the pixels – maintaining high efficiency while doing that is mind numbing.

Shine uses CG Graphics. Which is blistering fast. If you do not want to write the declare I can highly recommend the MBS plugins.
But they are not cross platform.

[quote=73368:@Christoph De Vocht]Shine uses CG Graphics. Which is blistering fast. If you do not want to write the declare I can highly recommend the MBS plugins.
But they are not cross platform.[/quote]
Thanks

Shine is written with Xojo and it uses mainly CoreImage. CoreImage is OS X only, and a pig to deal with, but the end results are beautiful.

While I understand the need to do x-plat, you should perhaps look into thinking of using CoreImage on the Macintosh and the Windows equivalent (or digging into DirectX on windows). The reason being is that CoreImage, is heavily optimized by Apple, it takes advantage of GPUs and multi-core processors, without me having to worry about it (there are other things to worry about).

I’ve had a report from a customer who just received his brand new Mac Pro, and he claims that Shine outperforms the competition on his new machine. I explained that I couldn’t really take the credit, because it’s Apple that do the heavy lifting and so I’m not surprised that Shine performs better than the competition, as I would imagine Apple’s OS and frameworks to be heavily optimized for the Mac Pro.

We current HDR (High Dynamic Range) software uses some C++ code I wrote as a plugin, and while it’s adequate, I have a prototype engine running in CoreImage, and it’s so much faster.

Maybe you should have a look on this plugin: http://www.xojo3d.com/index.php (For RS http://www.real3dtutorials.com/) to see if OpenGL is fast enough.

If OpenGL is fast enough. You could write your own declares to OpenGL, as you said; you don’t like to use third party plugins.

Attached three links with declares for visual basic where they are using GLFW (http://www.glfw.org/) for creating windows with OpenGL

(What is GLFW: http://www.glfw.org/faq.html#11__what_is_glfw)

  1. glfw.bas
    https://wiki.ices.utexas.edu/clsb/browser/branches/single/moil.source/zmoil/sdkpub/glfw/support/visualbasic/bindings/glfw.bas
  2. glu32.bas
    https://wiki.ices.utexas.edu/clsb/browser/branches/single/moil.source/zmoil/sdkpub/glfw/support/visualbasic/bindings/glu32.bas
    3.opengl32.bas
    https://wiki.ices.utexas.edu/clsb/browser/branches/single/moil.source/zmoil/sdkpub/glfw/support/visualbasic/bindings/opengl32.bas

Example Code: for above: https://wiki.ices.utexas.edu/clsb/browser/branches/single/moil.source/zmoil/sdkpub/glfw/support/visualbasic/examples/Triangle.bas

I guess this should not be so difficult to convert the declares from visual basic to Xojo.

[quote=73343:@Oliver Scott-Brown]
I was just wondering if Xojo is capable of high performance demanding graphics manipulation.
Thanks[/quote]
I suggest you experiment with Xojo’s graphics performance before diving into declares and plugins. Since we know almost nothing about what you are trying to accomplish, it’s possible that Xojo can do the job without any outside help. I would start there and go to declares or plugins if the performance requires it.

Exactly what kind of manipulation do you want to do?
I have done a lot of things in my PaintDS program, and Tomas Erwin has done even more in his ImagePlay library
almost all of it in pure XOJO code.

And I would contend that “fast” is relative…everything I am doing in PaintDS is fast enough to keep ahead of the users workflow which is most important. Would “C” or custom plugins make it FASTER… sure, but you need to find the balance.

Plus know how best to optimize your solution. An example… I had a routine that counted the number of unique colors in an image. The method that had been in use for years took 1.6 seconds for a quite large image. Making one simple change to a data structure, dropped that to 0.7 seconds for the same image (this was in the IDE… so compiled it was even faster)

[quote=73516:@Dave S]Exactly what kind of manipulation do you want to do?
I have done a lot of things in my PaintDS program, and Tomas Erwin has done even more in his ImagePlay library
almost all of it in pure XOJO code.

And I would contend that “fast” is relative…everything I am doing in PaintDS is fast enough to keep ahead of the users workflow which is most important. Would “C” or custom plugins make it FASTER… sure, but you need to find the balance.

Plus know how best to optimize your solution. An example… I had a routine that counted the number of unique colors in an image. The method that had been in use for years took 1.6 seconds for a quite large image. Making one simple change to a data structure, dropped that to 0.7 seconds for the same image (this was in the IDE… so compiled it was even faster)[/quote]
PaintDS looks really cool. I like the way it looks like it acts the same as MSPaint. How come it is not available for Linux? Is there something platform specific or is it just not worth releasing for Linux?

Thanks

Thanks… and it was modeled after MSPaint… but with a few things MSPaint didn’t have…

Very good reason there isn’t a version for Linux… I have no way of testing to make sure it works properly.
I didn’t bother designing it to work with Windows as there are many alternatives available there… but not as many for OSX.

[quote=73535:@Dave S]Thanks… and it was modeled after MSPaint… but with a few things MSPaint didn’t have…

Very good reason there isn’t a version for Linux… I have no way of testing to make sure it works properly.
I didn’t bother designing it to work with Windows as there are many alternatives available there… but not as many for OSX.[/quote]
Fair points. Is programming more a hobby for you or is it your full time job? Don’t you have a Windows PC to install Linux on for testing.

Thanks

Programming has been my career for the past 35 years… but not using Xojo…
I am a Senior Application Design Consultant for one of the largest Healthcare firms in America

So the proper answer is … yes it is a hobby, and yes it is my full time job … but with different tools and different enviornments

And I have many computers that I could install Linux on… but it holds no interest for me…at the moment…

And while Xojo is xplat… there is (discounting updates/upgrades) only one OSX and only one WIndows… but there seems to be dozens if not more levels of Linux… it just isn’t worth the trouble

[quote=73541:@Dave S]Programming has been my career for the past 35 years… but not using Xojo…
I am a Senior Application Design Consultant for one of the largest Healthcare firms in America

So the proper answer is … yes it is a hobby, and yes it is my full time job … but with different tools and different enviornments

And I have many computers that I could install Linux on… but it holds no interest for me…at the moment…

And while Xojo is xplat… there is (discounting updates/upgrades) only one OSX and only one WIndows… but there seems to be dozens if not more levels of Linux… it just isn’t worth the trouble[/quote]
Nice.

Oliver FWIW I have tried using Linux as my primary OS to get off Windows – for the last 10 years I have been trying. Mainly trying Debian and Red hat. I came close with Ubuntu but I always ran into some software challenges for my enterprise. Finally 3 years ago I made the Switch to Mac os and never looked back. I ran Windows for 2 of those 3 years in a VM guest to use Visio, but I have now been using Omni Graffle and soon to use Dave’s software Snapdragon. OSX is based on BSD so I get all of my great CLI tools, with the Cocoa framework for GUI apps. I can tell you Linux as a primary desktop for home/college/etc is fine, but I have found to be a challenge in the enterprise business world. Thankfully OSx has been more than a valid option for a while now for me.

BTW gimp is the go to on Linux for graphics manipulation. :slight_smile: