Xojo and Three.js

I am considering the development of a web app that would require medium/intensive 2D/3D features, for CAD and 3D modelling. The open source library Three.js would seem like a good choice as it offers all the features I’d need.

Will I be able to use it with Xojo Web? I have a long experience with Xojo Desktop, and of course I have many libraries of math and geometry functions I’ve developed over the years, and I know html, css and some js/ts, but my “field” experience with web development is very limited.

You’d likely need to use the Web SDK to write a plugin (or have someone write one for you) to use that Library but once you had that, then yes, I think you could use it with the Web framework.

1 Like

With a LOT of work, maybe. Xojo Web is really limited and not suited for heavy work due to its nature of high client/server comunication and being single threaded app. Out of the box, xojo sucks for editor like apps, the delay between the user action and the app responding is too high.

But if you create all the controls/editors with the SDK and move most of the load to the client side end avoiding the roud trip to the server for every action, should be doable.

Thanks. I’m watching the video about the WebSDK right now and though it does not seem overly complicated, it looks like an extra cost. Are there any tutorials/articles about wrapping a JS library with WebSDK?

Tutorials, no but there are example projects that ship with Xojo so you can see what a custom control looks like on the inside. There are also developers like @Anthony_G_Cyphers who you might be able to hire for a few hours to teach you enough to get you going.

1 Like

Thinking about this more, if you’re going to create a CAD app, it really should be a desktop application given how graphical and interactive CAD is. As an example, this CAD app (http://www.realcadd.com/) is completely written in Xojo so you can see it’s quite capable.

Thanks for getting back to me. I know realcadd very well and it is an excellent product. There’s also the excellent TouchCad which is made with Xojo. The fact is, I am the developer of HighDesign, an architectural design app for Mac & Win which - you may not know - is also written in Xojo.

The problem is, I am hitting some limitations in the framework that are concerning. Specifically, some bugs and missing features in the GraphicsPath class and especially the lack of 3D support have pushed me to consider the development of a web app that uses a solid library.

There are many CAD web apps: SketchUp, OnShape, AutoCAD, Ares Kudo, just to mention a few. That is my competition.


Can you provide some details on the issues with GraphicsPath? You could potentially use the library just for the 3D rendering and display the results via the HTMLViewer control. Would that work?

Issues 60032, 66056
Printing on Mac, there is an offset between GraphicsPath and other graphics functions, such as DrawLine(), DrawText(), DrawPicture().
The main issue is that the easy, but annoying, fix to add the bottom and left margins to all DrawPath and FillPath calls does not work when the current printer is set to “Generic”.

I lost countless hours trying to find a viable workaround and replying to angry customers. I had to manually parse the PrintSetup plist returned from NSPrinter (using MBS) to find a variable that would indicate when the current printer is generic and apply the offsets accordingly.

Issue 63658
graphicspath.addarc - clockwise boolean and angle incorrect.
It seems that the cw/ccw parameter is inverted, so instead of drawing 1/4 of circle in the IV sector, it draws 3/4 of circle. This too made me lose time trying to understand the logic behind the AddArc() function.

Another issue I did not report, on the Mac:

var oval As New GraphicsPath

// If I pass True for the clockwise param in AddArc, the circle is not drawn
// it only works if clockwise = false
// Works fine on Windows
oval.AddArc(Ax, Ay, radius, 0.0, kPI*2, false)
g.DrawPath(oval, true)

A very important missing feature 70926 is the ability to add sub-paths to open holes inside a path. I actually requested this years ago, but my request was closed as “implemented” when the ClipToPath() function was added. Clearly the engineers did not understand my request.

Regarding 3D, no, sorry, an html viewer to render a model would not work at all. I need to access the scene, perform HitTest to highlight and select items, show real-time info boxes on the selected items, track pointer movement. I need Metal and Direct3D, or something at that level.

I am currently developing the 3D I need using MBS SceneKit on the Mac, which is fine for the moment (and thank God for Christian and Björn), but obviously it is Mac only. I need a cross-platform, professional solution that will give me access to the technologies that my pro customers rightly expect in 2023.

1 Like

Thanks for the Issue numbers. I’ll take a look. Regarding 3D, would using the OpenGLSurface work?

I thought you were pushing to deprecate that @Geoff_Perlman, despite there being no viable GPU accelerated alternative offered?

OpenGL is still a valid API, but I am hesitant to invest time implementing my 3D framework around OpenGL, seeing that the OpenGLSurface is already scheduled for retirement in Xojo. It is true that OpenGL is no longer in active development as it has been superseded by Vulkan, and Apple deprecated it long ago. Anyway, I could resume my old code for OpenGL if I knew it won’t be deprecated in the next 2-3 years while a more modern 3D library is implemented in Xojo.

Besides, modern mobile apps absolutely need to have 3D, not just for games: think about that, Apple is developing AR glasses, MS and Meta have long been working on AR/VR, Flutter recently announced faster, gpu graphics and 3D. There are many applications for 3D and AR in mobile apps: remote collaboration, shopping, photogrammetry, health apps, architecture and building management…

1 Like

I see. Just to be clear, DesktopOpenGLSurface is not deprecated.

1 Like

Thanks for bringing these to our attention since they were blocking your progress. They are now all fixed.


Thanks for your time and assistance, that’s appreciated!

1 Like