OpenGLSurface needs a modern equivalent

Do you know how this is accomplished?

As long as you’re running Mac OS X 10.14 or newer and it handles it automatically for you. Each canvas basic has it’s contents cached to the GPU to speed up WindowServer. It’s what enables silky smooth control animation.

I even used this for the animation in the Sleep Aid about box, it’s just a bunch of canvases in principle.

I need both 2D and 3D. The 3D does not have to be very advanced, as I’m not into games. At present , I use Jeff Quan’s 3D unit, which works well but does not have support for Apple Silicon at present.

I like to build tools and experiment with the underlying technologies. Yeah I could use a game making tool such as Unity or GameMaker but I enjoy (for the most part) coding in the Xojo IDE.

Perhaps you are right but this is kind of a “chicken and egg” scenario. People don’t try to make games (even casual ones) with Xojo because it doesn’t have a decent canvas. Perhaps they would if one existed. People like me will write the support frameworks (like physics engines and entity component systems) because they enjoy doing it. Given Xojo touts is targets students, young people and beginners, I would think the casual games market is a nice hook.

1 Like

After writing a few programs in Vulkan with Visual Studio 2022 C++, I attempted to try and make a plugin. All I am trying to do is to create a run() method to execute the C++ code through a plugin in Xojo. Unfortunately, too many errors.

Here is a simple quad in Vulkan on Windows:

I have no problem writing individual methods as a plugin for Xojo, but unfortunately, I am not able to convert an existing C++ program to a plugin. Is there a template somewhere that shows or has instructions on some conversion for Xojo?

The example program is 1,147 lines of code to draw a quad. I am hoping that I don’t have to create a few hundred methods in a Xojo plugin, since that would be too overwhelming and time-consuming. :slight_smile:

1 Like

@GarryPettet I tried your Demo (Win10) and I can’t see a “hammered” CPU. Just my GPU is going up a little bit.
How do you measure (tools)?

There are the example projects I guess in the SDK.

And then there are my open source plugins Einhugur Software - Open source projects

Their somewhat good source and somewhat not. (Since I adopted them obviously and have not cleaned them 100% up even if I have done a lot, and their not built up from ground the way I do them normally)

Thank you Bjorn. I will take a look at the open source plugins.

I won’t complain about the code, since working code is waaaaay better than non-working code :slight_smile:

Would probably advice looking at the ComplexMatrix plugin rather than the fpPlugin, the former one has been refactored a bit more. The other still has some known memory leak issues and memory clobbering issues.

1 Like

I haven’t tested the demo on Windows, just iOS and macOS. I would be shocked if it runs faster on Windows than macOS.

Gotchya.

In the past Xojo had several tools for games, some 3D functionality (which we used to make casual games in 2005/06) and the Sprite surface (which I never used).

In 07 when we had a top ten hit with Recyclorama (Recyclorama - WildTangent Games) that was made using the canvas, declares and plugins to get the best performance we could.

I agree with you that it is probably chicken and egg, the Xojo market is too small to include games development. If you create tools, you’re limited on how many copies you can sell. Yet without game making tools, the market can’t really expand to include game development. I imagine it would require huge investment from Xojo to make that happen.

1 Like

Don’t be. Windows doesn’t have triple buffering. Our games ran faster on Windows than macOS, even with older hardware. I managed to close that gap by utilizing CGLayers (which don’t exist any more, CaLAyers are the replacement), but not completely.

So that’s the crux of my question. Since Mac OS handles this automatically, I wonder what Xojo could be doing that would cause drawing to happen on the CPU and not the GPU.

1 Like

I am sorry if I gave that impression, the drawing still takes place on the CPU, the cached image is stored in the GPU memory and the GPU is responsible for displaying it on screen.

If you want to do GPU drawing, you should look into using Metal.

Well, good news. Created a Vulkan plugin with C++ on the development machine for Xojo. Below is an animated gif (poor video quality) of the running Vulkan program in Xojo.

XojoVulkanPluginTest

The next question is: Is there a market for a plugin like this?

3 Likes

To me, yes,

  • if it can provide the functionality that people are looking for,

(eg, for me and the OP, a ‘canvas like’ control that uses Vulkan to render rather than CPU)

  • if you can write it in a reasonable timeframe

and

  • if what you can charge for it covers your time.

Maybe it’s a crowdfunding sort of thing.

If someone could create a plug-in that gives me an API like the traditional canvas (e.g draw a picture or draw an oval/line to specific coordinates) I would pay for that. Heck I’d be willing to set up a crowd source page for it and chuck in £500 to start it.

It’s important that the API is close to the existing canvas though - I don’t want to learn Vulkan or metal to use the control.

3 Likes

I think we can use it too if it supports the canvas methods and behave like it. Support for 2D graphics is all we need.

We have some projects depending on the canvas and would make use of it.

We would also put some bucks in a crowdfunding when it is released as open source or buy it for a reasonable price if closed source. We prefer the open source way so we can participate in maintaining it, but that is up to the creator.

+1

To clarify, I also am only interested in 2D.

1 Like

Hi
I always use pixmapshapes to draw on canvas
I have the fixed picture elements in canvas.backdrop and I draw the variable ones in a stack on top of each other in canvas.paint

example see below

https://www.dropbox.com/s/le3mwcel4vs1z5g/test-shapespeed.xojo_binary_project?dl=1