I was wondering what’s the behaviour of OpenGL when one tries to apply a texture on a square whose vertices do not lay on the same plane.

What I would like to do is applying some textures downloaded from GoogleMaps on a squared elevation grid. Else you can advise me some other method? Should I triangulate the texures? If so how can I avoid to add discontinuities on the joints of triangles?

Not a problem to texture a non co-planar quad. Textures can be applied to a sphere if you want. The texture you bind will apply to all the vertex coordinates you send to OpenGL for that batch. The more tesselated the model the better the result when the vertex positions are not in the same plane.

I mean, I suppose that I should divide the square in at least two triangles and then apply that texture to each triangle.
Let’s say that I have a square with 4 vertices on 4 different altitudes. I can compute the altitude of the center of the square as a mean of the altitudes of the 4 vertices.
Then I can divide the square in 4 triangles joining in the center of the square.
The texture I have is a ortho projection of my “pyramid”.
How can I map correctly that texture on the 4 triangles composing my pyramid?
Any help is much appreciated.