caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Announce: ocaml bindings for gles 3
@ 2016-03-05 23:18 Christophe Raffalli
  2016-03-06  0:42 ` Hendrik Boom
  0 siblings, 1 reply; 5+ messages in thread
From: Christophe Raffalli @ 2016-03-05 23:18 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 4162 bytes --]

Dear OCaml user,

I am please to annouce a first alpha release of gles3 for OCaml.
These are lightweight bindings for gles3, a join work with Alexandre
Miquel.

The package should be in the opam repository soon.
URLs: http://lama.univ-savoie.fr/~raffalli/gles3/
      http://lama.univ-savoie.fr/~raffalli/gles3/gles3-050316.tar.gz

This is also a call for contributions, mainly:
- to test and debug
- port the egl.ml file to other platforms than linux/EGL/X11
  (windows, OSX, linux/wayland, ios, android, ...)

Cheers,
Christophe Raffalli

--------------------------------------------------------------------
                         [1]OCaml [2]GLES 3.0 bindings

                            examples with shadows

Introduction

   This project aims at providing a portable way to do OpenGL (precisely
   GLES) application using OCaml. It comes in three parts:
     * Low level bindings which allow to call directly GLES functions.
       This binding tries to be reasonably type-safe using polymorphic
       variants to encode Glenum type. The low level bindings also provide
       some sanity checks for the size of bigarrays which allow to capture
       quite a lot of errors with clear messages.
     * High level bindings: to provide some auxiliary functions like
       matrix inversion and ease the development. For instance, to use
       shaders, with the high level bindings, you use compile_shader with
       the sources code, get a value of type unit program. Then, you can
       set the variables of the shaders (uniform or attributes), either as
       constant or function and get a function to finally run the shaders.
     * A way to open a window, start the main loop and interact. Currently
       only EGL under X11 is supported but it would be nice to have
       support for other platforms (windows, OSX, android, ios, wayland,
       ...) with exactly the same interface.

Authors

     * [3]Alexandre Miquel (initial low level bindings for GLES 2)
     * [4]Christophe Raffalli (partial port to GLES 3.0, high-level
       bindings and examples)

Documentation

     * [5]Generated html from the MLI files
     * the examples:
       [6]examples/testa_gles.ml: a rotating cube
       [7]examples/testb_gles.ml: a rotating cube with a texture
       [8]examples/testc_gles.ml: 7 rotating cubes with simple shadow
       mapping
       [9]examples/testd_gles.ml: 7 rotating cubes and 8 implicit surfaces
       with simple shadow mapping

TODO (please contribute !)

     * test and fix bugs !
     * documentation
     * complete the low-level bindings
     * develop the high-level bindings guided by more examples
     * provide support for more platforms (see introduction)
     * find a way to support multiple version of GLES (at least 2.0, 3.0,
       3.1) with only one OCaml library, and possibly in a transparent way
       when using the high-level bindings (i.e., the high lebel bindings
       should test the version and make the best choice)
     * collect regexp for error message in GLSL for most GLES vendors to
       give good error messages in all cases (only one vendor,
       nouveau/mesa supported currently). This is a pity that GLES does no
       define a standard at least for position in error messages.
     * ...

Known bugs

     * Mixing vertex arrays and buffer seems not to work (but no error
       flag are positionned), for instance, vertex in a buffer and normal
       in an array result in wrong normals. One shoud check this on a C
       program...
     * Textures are not yet garbage collected ... should be fixed soon

Références

   1. http://caml.inria.fr/
   2. https://www.khronos.org/registry/gles
   3. https://www.fing.edu.uy/~amiquel/
   4. file:///~raffalli
   5. file:///home/raffalli/Caml/gles3/main.html
   6. file:///home/raffalli/Caml/gles3/repos/examples/testa_gles.ml
   7. file:///home/raffalli/Caml/gles3/repos/examples/testa_gles.ml
   8. file:///home/raffalli/Caml/gles3/repos/examples/testa_gles.ml
   9. file:///home/raffalli/Caml/gles3/repos/examples/testa_gles.ml

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

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

* Re: [Caml-list] Announce: ocaml bindings for gles 3
  2016-03-05 23:18 [Caml-list] Announce: ocaml bindings for gles 3 Christophe Raffalli
@ 2016-03-06  0:42 ` Hendrik Boom
  2016-03-06 11:14   ` Christophe Raffalli
  0 siblings, 1 reply; 5+ messages in thread
From: Hendrik Boom @ 2016-03-06  0:42 UTC (permalink / raw)
  To: caml-list

On Sun, Mar 06, 2016 at 12:18:02AM +0100, Christophe Raffalli wrote:
> Dear OCaml user,
> 
> I am please to annouce a first alpha release of gles3 for OCaml.
> These are lightweight bindings for gles3, a join work with Alexandre
> Miquel.

Aren't there already bindings of OpenGL for OCaml?

Presumably there are advantages to this new one, otherwise you probably 
wouldn't have gone to all the trouble of writing it.

What are they?  Might there be a reason to convert my rather feeble 
video game to gles3?  (I'm currently using glMlite)

-- hendrik

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

* Re: [Caml-list] Announce: ocaml bindings for gles 3
  2016-03-06  0:42 ` Hendrik Boom
@ 2016-03-06 11:14   ` Christophe Raffalli
  2016-03-06 14:03     ` Hezekiah M. Carty
  0 siblings, 1 reply; 5+ messages in thread
From: Christophe Raffalli @ 2016-03-06 11:14 UTC (permalink / raw)
  To: Hendrik Boom; +Cc: caml-list

[-- Attachment #1: Type: text/plain, Size: 2195 bytes --]

On 16-03-05 19:42:46, Hendrik Boom wrote:
> Aren't there already bindings of OpenGL for OCaml?

Yes, but not for recent version of Open LG (i.e. version 3 and 4) or
GLES (any version).

gles3 are bindings for GLES which is available on every platforms
including cell phones and tablets.

The bindings also try to be different. Let me recall some context to
explain...  There are also some discussions about teaching below ...

In OpenGL 1 series, you could send the vertices of your object using
one function call per vertex. There was a fixed pipeline processing
your data using a lot of state variables.  There was also a stack of
matrices transformations.

With the apparition of GLSL (the Open GL Shading Language). All this
was not really used anymore, as the user is now free to do the
computation
 - on CPU
 - on GPU, for each vertex
 - on GPU, for each fragment

This is very flexible indeed. And the way to share data also improved
with VBO.

In GLES and Open 3 or 4, the fixed pipeline, the possibility to send
vertices one by one, matrices stack, ... have all been
removed. Shaders are mandatory if you want to render anything.

To my knowledge there are no bindings for Open GL >= 3 or GLES from
OCaml. So this is the first.

One problem with recent Open GL is teaching ... From C this is very
technical and almost unasable with students. The idea of my bindings
is to have

- lowlevel bindings that are already a bit easier than using C
  directly (more errors detected at typing and runtime).

- highlevel bindings usable by students, but also more confortable for
  the general programmer. I actually used thess bindings with my
  students this year ... Not perfect yet, but better than C or old
  OpenGL OCaml bindings.

I hope this clarify things ...

> Might there be a reason to convert my rather feeble
> video game to gles3?  (I'm currently using glMlite)

glMlite (from the web page) is OpenGL 1/2 with a sentence I do no get fully:
"glMLite is ready to develop forward compatible OpenGL 3.X programs!"

To know if should switch to gles3 .... you have to give it a try ...
If you have improvment to gles3 that would make you switch, please contribute !

Cheers,
Christophe

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

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

* Re: [Caml-list] Announce: ocaml bindings for gles 3
  2016-03-06 11:14   ` Christophe Raffalli
@ 2016-03-06 14:03     ` Hezekiah M. Carty
  2016-03-06 16:25       ` Christophe Raffalli
  0 siblings, 1 reply; 5+ messages in thread
From: Hezekiah M. Carty @ 2016-03-06 14:03 UTC (permalink / raw)
  To: Christophe Raffalli, Hendrik Boom; +Cc: caml-list

[-- Attachment #1: Type: text/plain, Size: 489 bytes --]

On Sun, Mar 6, 2016, 6:16 AM Christophe Raffalli <
Christophe.Raffalli@univ-savoie.fr> wrote:

> On 16-03-05 19:42:46, Hendrik Boom wrote:
> > Aren't there already bindings of OpenGL for OCaml?
>
> Yes, but not for recent version of Open LG (i.e. version 3 and 4) or
> GLES (any version).
>

There are thin bindings to OpenGL 3+4 and GLES 2+3:
http://erratique.ch/software/tgls

They have been around for a while, with the first release back in 2014 and
the most recent last year.

Hez

>

[-- Attachment #2: Type: text/html, Size: 1019 bytes --]

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

* Re: [Caml-list] Announce: ocaml bindings for gles 3
  2016-03-06 14:03     ` Hezekiah M. Carty
@ 2016-03-06 16:25       ` Christophe Raffalli
  0 siblings, 0 replies; 5+ messages in thread
From: Christophe Raffalli @ 2016-03-06 16:25 UTC (permalink / raw)
  To: Hezekiah M. Carty; +Cc: Hendrik Boom, caml-list

[-- Attachment #1: Type: text/plain, Size: 1345 bytes --]

On 16-03-06 14:03:42, Hezekiah M. Carty wrote:
> On Sun, Mar 6, 2016, 6:16 AM Christophe Raffalli <
> Christophe.Raffalli@univ-savoie.fr> wrote:
>
>     On 16-03-05 19:42:46, Hendrik Boom wrote:
>     > Aren't there already bindings of OpenGL for OCaml?
>
>     Yes, but not for recent version of Open LG (i.e. version 3 and 4) or
>     GLES (any version).
>
>
> There are thin bindings to OpenGL 3+4 and GLES 2+3:
> http://erratique.ch/software/tgls
>
> They have been around for a while, with the first release back in 2014 and the
> most recent last year.

Hello,

I did not know these bindings, but there are too lowlevel for what I
want when I teach (only one type for GLenum).

The lowlevel bindings of gles use polymorphic variant, so reading the
mli, you know what is allowed for a given GL function.

Moreover, the highlevel bindings provide the necessary functions to
really program. For instance, the Matrix module provide a function to
compute the NormalMatrix from the ModelView matrix. I know it is not
hard to inverse/transpose and extract a sub 3x3 matrice from a given
matrice, idem for an equivalent to the lookat GLU matrix ... But it is
better if this is already done.

The idea would be to have (we are not there yet) Highlevel binding
that can not trigger GLerror ... with little impact on performance.

Cheers,
Christophe

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

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

end of thread, other threads:[~2016-03-06 16:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-05 23:18 [Caml-list] Announce: ocaml bindings for gles 3 Christophe Raffalli
2016-03-06  0:42 ` Hendrik Boom
2016-03-06 11:14   ` Christophe Raffalli
2016-03-06 14:03     ` Hezekiah M. Carty
2016-03-06 16:25       ` Christophe Raffalli

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