Some of you might have seen on the Xojo3D.com website, that I’m busy working on an open source 3D engine written in pure Xojo known as X3.
Recently I’ve added a brand new X3Canvas control to the X3Core module. This canvas control mimics the native 2D Xojo Canvas control exactly, except that it uses OpenGL for rendering. X3Canvas also provides additional features for working with 3D graphics.
The point is, with X3Canvas you can now mix 2D and 3D graphics seamlessly, and using it is just as easy as it is to draw with the native Xojo canvas control.
Simply add the X3Core module to your project, drag the X3Canvas onto your Window, and access the Canvas.Graphics property to start drawing pictures and text exactly how you would with the native Xojo canvas control.
I would like to share one of the more advanced features of X3Canvas though, the new ModelMouseDown event. It does exactly what it implies… when a user clicks with his mouse on the X3Canvas control, a ModelMouseDown event is raised that returns the 3D (or 2D) X3Model that the user clicked on. You can manipulate models in your scene effortlessly by using this event. All the math complexity of picking models from 3D (or 2D) space is done automatically for you.
Here is a screenshot of the “selectmodel” project in the examples folder on GitHub.
This is amazing stuff, thanks a lot, Alwyn!
I have some problems running it on a Mac. It used to crash on the BGRABitmap assignment in X3Texture constructor the image size calculated was more than the size of the MemoryBlock.
I changed it to BGRABitmap = mb.StringValue(54, mb.size - 54) whch makes it run now but the look is not quite satisfying is there a difference in handling the alpha channel data on Mac vs Windows?
(The tiles demo gives a similar, yet somewhat less recognizable result)
An optimization we recently made for faster texture loading on Windows caused the crash on OS X.
I have already reverted the code back to the previous version that runs without error on OS X. In time I will implement the optimizations with compiler directives as to not affect the running on OS X. If you see any BGRABitmap properties you don’t have the latest version… all the properties should be named RGBABitmap.
BTW: Is a binary format the right one for a Git project? I cannot view changes in GitHub. Wouldnt it be better to use text or XML format?
And sorry for all the remarks: Somehow, though I told Git to synchronize, your latest changes have not been transferred, I noticed now. Ill remove my commit and try to access the real version. Sorry again!
Just pulled the latest version to my home PC and it updated the module with the latest changes.
Great stuff. Best way to learn Git is simply to start using it Things are working on this side, but I am not seeing any changes that you made?
I suppose not. I’ve really been using Git as an easy way to synchronize code between my work and home PC, and the binary format worked ok for that. I also want to make it easy for fellow Xojo developers to use X3 in their own projects by simply downloading a single X3 binary module and importing it with one action (instead of importing all the different classes individually).
But now that the project is getting bigger with some examples, and a handful of gaming developers adopting X3 for their own game engines, I plan to relook the GitHub structure after the release of version 0.3.0 of X3 (the version being worked on now).
To be honest, I also probably also need to watch the Git seminar to get a better understanding of Git. My understanding is limited to:
Pull - Get the latest version from the server.
Push - Send my changes to the server.
Revert - Rollback changes that broke something.
I’m very spoiled with TortoiseGit in Windows, since it is integrated with the Windows Explorer and hides all the complexity of Git from the user. I simply right-click and select push or pull.
If there are other users interested in contributing to X3, I think we need to look at the branching and merging features to keep things organized. Currently all the changes are committed on a single master branch. I know about these features but haven’t really used it before. As soon as v0.3.0 is released, I’ll revisit the whole way X3 is currently stored in GitHub.