Commit graph

7 commits

Author SHA1 Message Date
Matthew Waters
16cba63d43 gl/utils: fixup matrix math again for column major
e4bf9ed8f0 was not quite right and changed
the wrong thing. Intead we needed to change the multiplication order
and should have kept the previous to/from matrices as is done in this
patch.
2018-07-10 20:13:22 +10:00
Matthew Waters
e4bf9ed8f0 gl/utils: Fix NDC conversion matrices for column-majorness
The matrices were converting the wrong values with non-diagonal-only matrices.
e.g. a typical yflip matrix in [-1,1]^3 such as
 1  0  0  0
 0 -1  0  0
 0  0  1  0
 0  0  0  1

Would have actually required a matrix like this in [0,1]^3
 1  0  0  0
 0 -1  0  0
 0  0  1  0
 0 -2  0  1

Which is
1. not consistent with our multiplication convention and would require
   transposing matrices or changing our multiplication order (from what is
   generally used on opengl matrix guides/tutorials).
2. Produces incorrect values when input with actual vertices accounting for
   the difference in multiplication order.  e.g. some vertices multiplied by
   the yflip matrix using vertex * yflip(== transpose(yflip) * vertex):

     vertex:       -> result:           expected:
     vec4(1,0,1,1) -> vec4(1,-2,1,1)    vec4(1,1,1,1)
     vec4(1,1,1,1) -> vec4(1,-3,1,1)    vec4(1,0,1,1)

With the updated values, we now get the expected values.

Includes a test for this behaviour and the example above
2018-06-06 23:36:08 +10:00
Matthew Waters
21252d450c glutils: fix matrix operations everywhere
- correct the matrix multiplication
- Use column-major matrices
  - reverse order of matrix multiplications

https://bugzilla.gnome.org/show_bug.cgi?id=785980
2017-12-09 19:32:30 +00:00
Julien Isorce
4952fdd956 gl: do not include GL headers in public gstgl headers
Except for gst/gl/gstglfuncs.h

It is up to the client app to include these headers.
It is coherent with the fact that gstreamer-gl.pc does not
require any egl.pc/gles.pc. I.e. it is the responsability
of the app to search these headers within its build setup.

For example gstreamer-vaapi includes explicitly EGL/egl.h
and search for it in its configure.ac.

For example with this patch, if an app includes the headers
  gst/gl/egl/gstglcontext_egl.h
  gst/gl/egl/gstgldisplay_egl.h
  gst/gl/egl/gstglmemoryegl.h
it will *no longer* automatically include EGL/egl.h and GLES2/gl2.h.
Which is good because the app might want to use the gstgl api only
without the need to bother about gl headers.

Also added a test: cd tests/check && make libs/gstglheaders.check

https://bugzilla.gnome.org/show_bug.cgi?id=784779
2017-12-09 19:32:29 +00:00
Sebastian Dröge
dc28155e21 gl: Rename gst_gl_get_affine_transformation_meta_as_ndc_ext() to prevent symbol conflict
The same symbol also exists in libgstgl, although marked as private and
internal. This has no effect when doing static linking and there's a
symbol conflict.
2017-12-09 19:32:26 +00:00
Matthew Waters
de6c39189f glutils: privatise matrix multiplication/videoaffinetransformation retrieval 2017-12-09 19:32:26 +00:00
Matthew Waters
695601b7e0 gl/build: add missing build files
3f7b549881 was incomplete :(
2017-12-09 19:32:24 +00:00