Merge: lib/glesv2: intro framebuffer related services and try a new style
authorJean Privat <jean@pryen.org>
Wed, 11 Feb 2015 04:11:52 +0000 (11:11 +0700)
committerJean Privat <jean@pryen.org>
Wed, 11 Feb 2015 04:11:52 +0000 (11:11 +0700)
commit80f3b19308ea235c0f53303c817bbbe9d9984f41
tree9831d8b6190d7f6c9af599a39c22be80e4fae29c
parent104c5e8c1efa31c8944ad22b132891474c648b8d
parent350219075864c62f14be1117c63af60aa7ec410e
Merge: lib/glesv2: intro framebuffer related services and try a new style

The main point of this PR is to try a new naming convention for the glesv2 module.

Ideas behind this convention:
1. Be as close as possible to the C API: use the same function and macro names.
2. Modify those names only for compatibility with the Nit language: the macros cannot begin with `GL_` so use `gl_` instead.
3. Apply types and other Nity features when they can help and don't interfere with the original API.

It differs from the previous convention of renaming all entities to the Nit style. It is not heavier in the module definition but should be easier for the users.

In practice, to convert OpenGL ES C code to Nit you would need to change the prefix `GL_` to `gl_`, and remove `;`.

In C:
~~~
glBindFramebuffer(GL_FRAMEBUFFER, my_fbo);
glBindRenderbuffer(GL_RENDERBUFFER, my_renderbuffer);
return glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE;
~~~

In Nit:
~~~
glBindFramebuffer(gl_FRAMEBUFFER, my_fbo)
glBindRenderbuffer(gl_RENDERBUFFER, my_renderbuffer)
return glCheckFramebufferStatus(gl_FRAMEBUFFER) == gl_FRAMEBUFFER_COMPLETE
~~~

What do you think of the new naming convention? I would convert the whole module to it.

Pull-Request: #1157
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>