Commit graph

11 commits

Author SHA1 Message Date
Julien Isorce
d5563a0c06 gl: fix broken build due to previous commit 2fd84a6c
Can reproduce after installing libgraphene-dev

Also fixes caopengllayersink.h to anticipate build error on osx.

https://bugzilla.gnome.org/show_bug.cgi?id=784779
2017-12-09 19:32:30 +00:00
Matthew Waters
8f82ec9254 gltransformation: rewrite the inverse transformation logic
It now returns the correct values for both orthographic and perspective
projections and takes into account the aspect ratio of the video, handles
the Y-flipping in GL and by us and uses some more helpers from graphene.
2017-12-09 19:32:22 +00:00
Matthew Waters
7f10822de4 gl: use GLMemory for accessing textures everywhere
This simplifies and consolidates a lot of duplicated code creating
and modifying textures.
2017-12-09 19:32:21 +00:00
Matthew Waters
8ebea54758 gltransformation: use the affine transformation meta if available downstream
We can avoid a render pass if downstream supports the affine transformation meta
and increase the performance of some pipelines involving gltransformation.

Implemented by checking for the affine transformation in the allocation query
from downstream and combining our matrix with that of upstream's (or creating
our own).
2017-12-09 19:32:19 +00:00
Matthew Waters
1fe2996b01 gltransformation: implement navigation events
Reverses the transformation applied through the properties and forwards the
event.

The process for finding the coordinates on the video are as follows:
1. Convert the given pointer_x and pointer_y to model space at the near and far planes
2. Get the equation of the video plane
3. Find where the ray in 1 intersects the plane
4. Profit!
2017-12-09 19:32:14 +00:00
Lubosz Sarnecki
6a58c684a7 gltransformation: implement pivot point for rotation and scale
https://bugzilla.gnome.org/show_bug.cgi?id=744763

Add a pivot vector for setting the origin of rotations and scales.

With the pivot point the rotation and scale operations can have
different origins. This adds the ability to rotate around different points.
Currently the default (0, 0) pivot point is possible,
a rotation around the center, and zooming into and out of the center.

With an pivot point this is optional.
I defined the following image coordinates for the pivot point:

	 (-1,1) ------------------------- (1,1)
		|			|
		|			|
		|			|
		|	  (0,0)		|
		|			|
		|			|
		|			|
	(-1,-1) ------------------------- (1,-1)

Example:

	Rotate the video at the bottom left corner

	gst-launch-1.0 videotestsrc \
			! gltransformation \
		 		scale-x=0.5 \
				scale-y=0.5 \
				rotation-z=25.0 \
				pivot-x=-1.0 \
				pivot-y=-1.0 \
			! glimagesink

The pivot-z option defines the pivot point in 3D space.
This only affects rotation, since we have no Z data to scale.
With this option a video can be rotated around a point in 3D space.

Example:

	Rotate around point behind the video:

    	gst-launch-1.0 videotestsrc \
			! gltransformation \
				rotation-x=10.0 \
				pivot-z=-4.0 \
			! glimagesink
2017-12-09 19:32:07 +00:00
Matthew Waters
65c57b77ff gl: element buffers are part of vao state
Use them as such.  They are also required for GL3 core profile support
with glDrawElements on OS X.
2017-12-09 19:32:01 +00:00
Nicolas Dufresne
345f1dfb64 gltransform: Fix includes of graphene headers
The graphene-1.0 part should not be in the source code. This directory
is part of the cflags include. This is similar to gstreamer-1.0/
directory. This break compilation if the include directory where
graphene is installed is not in your include path.
2017-12-09 19:31:55 +00:00
Matthew Waters
f99e9d01a9 gltransformation: support gl3 2017-12-09 19:31:51 +00:00
Lubosz Sarnecki
e3aa918032 gltransformation: fix issues and expose mvp matrix
* aspect should not be 0 on init
* rename fovy to fov
* add mvp to properties as boxed graphene type
* fix transformation order. scale first
* clear color with 1.0 alpha

https://bugzilla.gnome.org/show_bug.cgi?id=734223
2017-12-09 19:31:46 +00:00
Lubosz Sarnecki
7e6962c95e opengl: add element for transforming video geometry
* add graphene as soft dependency for linear algebra
2017-12-09 19:31:43 +00:00