Are there cross-compilable OpenGL examples made with Oxygene?

爱⌒轻易说出口 提交于 2019-12-23 22:32:32

问题


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)?


回答1:


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:

  • With FreePascal, which has built-in OpenGL units, and already several libraries over it - one of the most powerful/known is GLScene;
  • With SmartMobileStudio, which has built-in WebGL support and can do amazing things on modern browsers - WebGL is a translation of the OpenGL API/concepts in HTML5.



回答2:


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.




回答3:


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



来源:https://stackoverflow.com/questions/16806810/are-there-cross-compilable-opengl-examples-made-with-oxygene

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!