caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] OpenGL ES for iPhone Simulator; working example app
@ 2011-08-22 17:40 Jeffrey Scofield
  2011-08-24  9:17 ` sashan
  0 siblings, 1 reply; 8+ messages in thread
From: Jeffrey Scofield @ 2011-08-22 17:40 UTC (permalink / raw)
  To: caml-list; +Cc: Jeffrey Scofield

Greetings,

A while back I modified LablGL to work with OpenGL ES 1.1, calling my
modified version LablGLES.  Just recently I got LablGLES working in the
iPhone Simulator, which I've found to be a nice prototyping environment
for iOS projects.

I also made an example LablGLES app that works on both the iPhone
Simulator and the iPhone itself.  It's called IcosaBlue, since it
displays a rotating blue icosahedron.  It's very simple, but it's a
complete example of an OpenGL ES iPhone app coded in OCaml.

For those interested in trying OpenGL ES on iPhone and the iPhone
Simulator, I've released sources and binaries for everything.  Here are
some links:

  [LablGLES, OpenGL ES for iPhone and iPhone Simulator][1]
  [IcosaBlue, rotating blue icosahedron using LablGLES][2]
  [General page of OCaml-on-iOS resources][3]
  [Home of LablGL, OCaml OpenGL interface by Jacques Garrigue][4]
  
[1]: http://psellos.com/ocaml/lablgles-build.html
[2]: http://psellos.com/ocaml/example-app-icosablue.html
[3]: http://psellos.com/ocaml/
[4]: http://wwwfun.kurims.kyoto-u.ac.jp/soft/olabl/lablgl.html

I'd be happy to hear from anybody interested in OCaml on iOS.

Jeffrey Scofield
jeffsco@psellos.com
Seattle


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Caml-list] OpenGL ES for iPhone Simulator; working example app
  2011-08-22 17:40 [Caml-list] OpenGL ES for iPhone Simulator; working example app Jeffrey Scofield
@ 2011-08-24  9:17 ` sashan
  2011-08-24 15:09   ` [Caml-list] " Jeffrey Scofield
  0 siblings, 1 reply; 8+ messages in thread
From: sashan @ 2011-08-24  9:17 UTC (permalink / raw)
  To: caml-list

On Mon Aug 22 10:40:50 2011, Jeffrey Scofield wrote:
> Greetings,
> 
> A while back I modified LablGL to work with OpenGL ES 1.1, calling my
> modified version LablGLES.  Just recently I got LablGLES working in the
> iPhone Simulator, which I've found to be a nice prototyping environment
> for iOS projects.
....
> 
> I'd be happy to hear from anybody interested in OCaml on iOS.


Thanks for this - will endeavour to look more closely into it.
I'm curious as to whether Apple would approve an app written in OCaml for
the app store. I was under the impression that they wouldn't.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Caml-list] Re: OpenGL ES for iPhone Simulator; working example app
  2011-08-24  9:17 ` sashan
@ 2011-08-24 15:09   ` Jeffrey Scofield
  2012-01-30 16:46     ` [Caml-list] " Christophe Papazian
  0 siblings, 1 reply; 8+ messages in thread
From: Jeffrey Scofield @ 2011-08-24 15:09 UTC (permalink / raw)
  To: caml-list

sashan <sashan@zenskg.net> writes:

> > I'd be happy to hear from anybody interested in OCaml on iOS.
> 
> 
> Thanks for this - will endeavour to look more closely into it.
> I'm curious as to whether Apple would approve an app written in OCaml
> for the app store. I was under the impression that they wouldn't.

Apple dropped their restrictions on languages for iOS around a year
ago.  The press release is still available here:

    http://www.apple.com/pr/library/2010/09/09statement.html

We (Psellos) are selling an app written in OCaml in the app store
right now, in fact.  It's called Cassino, and plays a card game.  At
the risk of too much self-promotion, here is a link:

   http://itunes.apple.com/us/app/cassino/id411381417

We've had no trouble getting versions of the app approved by Apple.
(Granted, we're not a big enough player to merit a lot of scrutiny.)

When we started porting OCaml to iPhone, it was with the attitude of
doing something slightly crazy, but it has worked out pretty well.
I think OCaml has real advantages for writing iOS apps, and it has
also been more fun and interesting than the usual coding for the
"mobile space".

Jeffrey


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Caml-list] OpenGL ES for iPhone Simulator; working example app
  2011-08-24 15:09   ` [Caml-list] " Jeffrey Scofield
@ 2012-01-30 16:46     ` Christophe Papazian
  2012-01-30 16:54       ` Jeffrey Scofield
  2012-01-30 17:11       ` Jeffrey Scofield
  0 siblings, 2 replies; 8+ messages in thread
From: Christophe Papazian @ 2012-01-30 16:46 UTC (permalink / raw)
  To: Jeffrey Scofield; +Cc: caml-list

Dear Jeffrey

I tried your solution for ocaml on Xcode 4.2 with iOS 5.0
But I can't find a way to get a good binary. I got some weird alignment warnings
on compilation and the application just doesn't work on the iPhone.

Do you have plan to update your work for the last versions of Xcode and iOS ?

Thank you, it would be so good to have a nice way to program iOS applications in OCaml !

Christophe



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Caml-list] OpenGL ES for iPhone Simulator; working example app
  2012-01-30 16:46     ` [Caml-list] " Christophe Papazian
@ 2012-01-30 16:54       ` Jeffrey Scofield
  2012-01-30 17:11       ` Jeffrey Scofield
  1 sibling, 0 replies; 8+ messages in thread
From: Jeffrey Scofield @ 2012-01-30 16:54 UTC (permalink / raw)
  To: Christophe Papazian; +Cc: Jeffrey Scofield, caml-list

Greetings,

> I tried your solution for ocaml on Xcode 4.2 with iOS 5.0
> But I can't find a way to get a good binary. I got some weird alignment warnings
> on compilation and the application just doesn't work on the iPhone.
> 
> Do you have plan to update your work for the last versions of Xcode and iOS ?
> 
> Thank you, it would be so good to have a nice way to program iOS applications in OCaml !

Yes, I will make it work with the latest Xcode and iOS.  Right now we're
in the last few weeks of releasing a new app, and I haven't wanted to disturb
our development process.

The native code generator of OCaml is based on the native assembler, so
generally you just have to make the assembler and the linker happy by
adapting the command lines from an ObjC project.

If you try any experiments, let me know what you find out.  Otherwise
I'll look into it as soon as I can.

Thanks for your interest and best regards,

Jeffrey



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Caml-list] OpenGL ES for iPhone Simulator; working example app
  2012-01-30 16:46     ` [Caml-list] " Christophe Papazian
  2012-01-30 16:54       ` Jeffrey Scofield
@ 2012-01-30 17:11       ` Jeffrey Scofield
  2012-02-01 13:43         ` Christophe Papazian
  1 sibling, 1 reply; 8+ messages in thread
From: Jeffrey Scofield @ 2012-01-30 17:11 UTC (permalink / raw)
  To: Christophe Papazian; +Cc: Jeffrey Scofield, caml-list

Christophe:

> I tried your solution for ocaml on Xcode 4.2 with iOS 5.0  But I
> can't find a way to get a good binary. I got some weird
> alignment warnings on compilation and the application just
> doesn't work on the iPhone.

One extra comment occurred to me:

We're doing development under Xcode 4.0.2 right now, but the
generated binaries work fine under iOS 5.0.  So any new
difficulties in Xcode 4.2 are almost certainly caused by changes
in Xcode's cross compilation toolchain.  Historically there have
been a few of these in each new release of Xcode.

Regards,

Jeffrey


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Caml-list] OpenGL ES for iPhone Simulator; working example app
  2012-01-30 17:11       ` Jeffrey Scofield
@ 2012-02-01 13:43         ` Christophe Papazian
  2012-02-01 16:30           ` Jeffrey Scofield
  0 siblings, 1 reply; 8+ messages in thread
From: Christophe Papazian @ 2012-02-01 13:43 UTC (permalink / raw)
  To: Jeffrey Scofield; +Cc: Caml List

I found a way to adapt your patch to cross compile ocaml 3.10
with the last Xcode and IOS SDK. But, I still get alignment warnings,
AND SEGFAULT if I use some ocaml instructions like (+.) (float addition).

However, I can get lucky and compile a stable binary (on iPhone) if I avoid some instructions..
I tried to adapt your patch to the last version of ocaml, but there was so many changes
in the assembler that I stop. If anyone has an idea to help me.

Question 2 : do you plan to release some general bindings to the iOS SDK ?

Thank you !

	Christophe

> 
> One extra comment occurred to me:
> 
> We're doing development under Xcode 4.0.2 right now, but the
> generated binaries work fine under iOS 5.0.  So any new
> difficulties in Xcode 4.2 are almost certainly caused by changes
> in Xcode's cross compilation toolchain.  Historically there have
> been a few of these in each new release of Xcode.
> 
> Regards,
> 
> Jeffrey
> 



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Caml-list] OpenGL ES for iPhone Simulator; working example app
  2012-02-01 13:43         ` Christophe Papazian
@ 2012-02-01 16:30           ` Jeffrey Scofield
  0 siblings, 0 replies; 8+ messages in thread
From: Jeffrey Scofield @ 2012-02-01 16:30 UTC (permalink / raw)
  To: Christophe Papazian; +Cc: Jeffrey Scofield, Caml List

Christophe:

> I found a way to adapt your patch to cross compile ocaml 3.10
> with the last Xcode and IOS SDK. But, I still get alignment
> warnings, AND SEGFAULT if I use some ocaml instructions like
> (+.) (float addition).

I'm glad you made some progress.  I have some earlier reports
of alignment warnings with Xcode 4.1, but things were otherwise
reported as working.  So the really worrying thing is the
segfault.  You kind of need (+.) to do real work!  There's some
chance this is the same alignment problem, though.

I'll pitch in to help get things working as soon as possible; I'd
love to see many people working with OCaml/iOS.

> However, I can get lucky and compile a stable binary (on
> iPhone) if I avoid some instructions..  I tried to adapt your
> patch to the last version of ocaml, but there was so many
> changes in the assembler that I stop. If anyone has an idea to
> help me.

The ARM code generator was completely rewritten for OCaml 3.12.
In fact our patches are based on the 3.12 version in some sense.
In particular, we adopted the 3.12 register assignment conventions
(which are consistent with iOS conventions).

I would expect almost all the patches to the code generator to
be unnecessary with 3.12.

There is an issue with native floating point.  As I understand
the situation, Xavier's 3.12 ARM generator uses function calls
to implement floating operations rather than in-line native
instructions.

Our patches include some work (by other folks, not us) to emit
native HW floating point instructions.  I haven't done any
testing of the difference, but our apps do some CPU intensive
calculations for short times (a card game, deciding what play to
make next).  So we'd kind of like to use native floating point.

> Question 2 : do you plan to release some general bindings to
> the iOS SDK ?


We don't have plans to release our Cocoa interface code right
now.  The example apps on our website (http://psellos.com/ocaml/)
demonstrate all the basic requirements.  The major differences in
our in-house code are that (a) we hook in to GC to free ObjC
objects when they're collected on the OCaml side; (b) we use
ObjC dynamic method dispatch, so we can write large parts of the
interface in OCaml.

Note that we don't have a system that generates the Cocoa/OCaml
interface automatically.  We add hand-coded classes and methods
to our interface as required.  It's a humble approach, but we
don't have the resources to do anything more elaborate right now.

Thanks for your interest; I'll be able to do more after the
release crunch.

Regards,

Jeffrey


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-02-01 16:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-22 17:40 [Caml-list] OpenGL ES for iPhone Simulator; working example app Jeffrey Scofield
2011-08-24  9:17 ` sashan
2011-08-24 15:09   ` [Caml-list] " Jeffrey Scofield
2012-01-30 16:46     ` [Caml-list] " Christophe Papazian
2012-01-30 16:54       ` Jeffrey Scofield
2012-01-30 17:11       ` Jeffrey Scofield
2012-02-01 13:43         ` Christophe Papazian
2012-02-01 16:30           ` Jeffrey Scofield

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).