summaryrefslogtreecommitdiffstats
path: root/sys/glsink/gstglxwindow.c
diff options
context:
space:
mode:
authorGernot Ziegler <gz@lysator.liu.se>2003-10-31 16:40:20 +0000
committerGernot Ziegler <gz@lysator.liu.se>2003-10-31 16:40:20 +0000
commit2afed7c92a10bf094172a84fd1a371b430c1b070 (patch)
tree43a0b454412de346f7fbe6c83f88e3b38a9f4786 /sys/glsink/gstglxwindow.c
parent2636f4ed33d00db4bdb8ee20d7411b680d44d68e (diff)
downloadgst-plugins-bad-2afed7c92a10bf094172a84fd1a371b430c1b070.tar.gz
gst-plugins-bad-2afed7c92a10bf094172a84fd1a371b430c1b070.tar.bz2
gst-plugins-bad-2afed7c92a10bf094172a84fd1a371b430c1b070.zip
glsink with correct threading support
Original commit message from CVS: glsink with correct threading support
Diffstat (limited to 'sys/glsink/gstglxwindow.c')
-rw-r--r--sys/glsink/gstglxwindow.c36
1 files changed, 34 insertions, 2 deletions
diff --git a/sys/glsink/gstglxwindow.c b/sys/glsink/gstglxwindow.c
index 79b743a0..3f9d3df9 100644
--- a/sys/glsink/gstglxwindow.c
+++ b/sys/glsink/gstglxwindow.c
@@ -44,6 +44,38 @@ GLfloat LightDiffuse[] = { 0.6, 0.6, 0.6, 1.0 }; /* bluish diffuse light. */
GLfloat LightPosition[] = { 1.5, 1.5, 1.5, 0.0 }; /* position */
+void
+gst_glxwindow_unhook_context(GstImageInfo *info)
+{
+ GstGLImageInfo *window = (GstGLImageInfo *) info;
+
+ if (window->ctx)
+ {
+ if (!glXMakeCurrent(window->dpy, None, NULL))
+ {
+ printf("Could not release drawing context.\n");
+ }
+ else
+ printf("Released drawing context.\n");
+ }
+}
+
+void
+gst_glxwindow_hook_context(GstImageInfo *info)
+{
+ GstGLImageInfo *window = (GstGLImageInfo *) info;
+
+ if (window->ctx && window->win && window->ctx)
+ {
+ if (!glXMakeCurrent(window->dpy, window->win, window->ctx))
+ {
+ printf("Could not acquire GLX drawing context.\n");
+ }
+ else
+ printf("Acquired drawing context.\n");
+ }
+}
+
static void
gst_glxwindow_free (GstImageInfo *info)
{
@@ -92,7 +124,7 @@ gst_glxwindow_callback(GObject *object, GParamSpec *pspec, GstGLImageInfo *data)
XMapRaised (data->dpy, data->win);
// resize OpenGL
- //g_warning("resizing in OpenGL");
+ g_warning("resizing in OpenGL");
glViewport(0, 0, (GLint) w, (GLint) h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
@@ -205,7 +237,7 @@ gst_glxwindow_new (GstElement *sink)
else
GST_DEBUG ("Sorry, no Direct Rendering possible!\n");
- GST_DEBUG("Initializing OpenGL parameters\n");
+ g_warning("Initializing OpenGL parameters\n");
/* initialize OpenGL drawing */
glEnable(GL_DEPTH_TEST);
//glShadeModel(GL_SMOOTH);