Are there cross-compilable OpenGL examples made wi

2019-07-10 20:03发布

We have a working OpenGL project made for PC (works on MacOS and Linux under Wine as well) which we want to try to cross-compile to tablets. Delphi XE2/XE4 offers iOS support, but there's no Android yet and judging from iOS implementation history it might take 1-2 years. Now we start looking into other possibilities which will allow us to keep the majority of Pascal codebase (80k lines). So here's the question for the Oxygene:

Are there any examples of OpenGL applications made with Oxygene that can be cross-compiled to work on PC/MacOS/iOS/Android ?

If not, what alternatives are there (except Lazarus)?

3条回答
我命由我不由天
2楼-- · 2019-07-10 20:08

AFAIK there is none.

Even the low-level Sugar cross-platform RTL is not finished. It would be a first mandatory step to be done before accessing higher level libraries in a cross-platform way (i.e. with identical source code), like OpenGL.

So with Oxygene, you have a great cross-compiler, but you are tied to use the RTL available on each platform.

You can compare with two object-pascal compilers:

查看更多
劳资没心,怎么记你
3楼-- · 2019-07-10 20:12

Oxygene doesn't attempt to be source compatible with Delphi. What's more the runtime libraries used by the various Oxygene flavours differ entirely from those used by Delphi. So you won't find any serious libraries that have single source that can compile on Oxygene and Delphi.


The way that RemObjects have developed Oxygene on different platforms is quite interesting and radically different from the approach taken by Embarcadero with Delphi.

With Delphi the goal is that you can single source development for all the platforms. That is made possible by the FireMonkey framework which presents a common interface to all platforms. Obviously you need to vary some elements of an app to account for device differences.

With Oxygene, each platform is targetted separately. So for Windows, the runtime is .net. For Java it is the JVM and for Apple platforms you target Cocoa.

All this means that you cannot expect to write a GUI app in Oxygene and have it work on multiple platforms.

So not only can you single source your app between Delphi and Oxygene, you cannot readily single source multiple Oxygene targets.


Now, you can probably port to Oxygene or FPC without too much trouble. But maintaining single source is liable to mean a lot more effort. Whether that's worth the effort is debateable. In the long run you'll want a codebase in one of Delphi, FPC, Oxygene, or even something radically different. But you won't want your code spread out over multiple languages.

查看更多
▲ chillily
4楼-- · 2019-07-10 20:18

You can write or own OpenGL layer in Oxygene with the usage of mapped types like it is used in the sugar open source project.

It sounds pretty cool. In your code you have just to use one class which is during compiling direktly mapped to the underlying platform class method, without an overhead of that layer.

IMHO, when Oxygene is growing, we will then find a lot of such "suger" layers and write once compile anywhere will come closer :)

Edit:
Using OpenGL with .Net
OpenGL Java Tuturial

查看更多
登录 后发表回答