2

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

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
Kromster
  • 7,181
  • 7
  • 63
  • 111

3 Answers3

4

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.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490
  • Source compatibility with Delphi is lower priority. We would be okay with migrating project to Oxygene if it can fulfill our needs. Right now I'm investigating OpenGL support. – Kromster May 29 '13 at 08:30
  • The question reads rather differently. The ability to single source appears to be a strong desire as I read the question. – David Heffernan May 29 '13 at 08:34
  • So you say that it seems FPC and Delphi has a much better chance of keeping the codebase cross-compilable with least change between platforms? – Kromster May 29 '13 at 08:34
  • Yes, single-source is a desire (of course with some IFDEFs), but the question is is it viable with Oxygene. If we move completely to Oxygene would we be able to have Win/nix/Mac/iOS/Android. OpenGL being the top importance – Kromster May 29 '13 at 08:37
  • Yes, that is absolutely the case. Remember iOS support in XE2 that used FPC as the compiler? That was possible because of FPC's language mode that is close to Delphi. Nothing remotely like that with Oxygene. On the other hand, Oxygene is a much more pure language and is not constrained by having to maintain compat with Delphi. – David Heffernan May 29 '13 at 08:37
  • I think you could use FPC or Oxygene now and Delphi in 12 months time. Question is where you want to be long term. – David Heffernan May 29 '13 at 08:47
4

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:

Arnaud Bouchez
  • 42,305
  • 3
  • 71
  • 159
2

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

Community
  • 1
  • 1
markus_ja
  • 2,931
  • 2
  • 28
  • 36
  • That's great, but are there any OpenGL examples that cross-compile with Oxygene right now? – Kromster May 29 '13 at 09:50
  • Sorry, I am not familiar with OpenGL at all. What I meant is, use an existing OpenGL framework e.g. .Net or Java ..., and write a sugar layer around it. Ask at RemObjects.com, if there already exits some examples. – markus_ja May 29 '13 at 09:57
  • I was hoping there are available examples specifically focused on OpenGL and showing how it all works for cross-compilation. After all someone has to write/maintain all these mappings. – Kromster May 29 '13 at 10:11