Querying GL context pixel format

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Querying GL context pixel format

Andrey Nechypurenko
Hi Folks,

I am currently working on Qt-based application which uses OpenGL context (texture) sharing technique to display video on 3D scene. I am using approach similar to the one implemented in cluttershare example from gst-plugins-gl. Currently it runs on Linux but does not work on Windows. I believe that the reason is that context sharing between Qt and Gstreamer does not work. According to the documentation, only contexts with the same pixel format could be shared. That is why I was looking for the way to query pixel format used with GL context created by gst-gl plugin and did not found it yet. I guess it just does not exists :-) .

So the question I would like to ask is whether it would make sense to add some kind of API to make it easier to access GL context created? For example, it could be callback set via certain property which is called right after the initialization step and provide corresponding handles (HWND, HDC, HGLRC or any other platform-specific handles similar to those stored in _GstGLWindowPrivate structure) which could be used with platform and GL API to query required information?

I would also appreciate any comments or pointers to the possible solution directions without extending the property set or API.

Regards,
Andrey.


     

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Querying GL context pixel format

Julien Isorce
Hi

set GST_GL_WINDOW_DEBUG=1
before launching the pipeline, it should output some debug informations about success or failure when sharing gl contexts.

I had no time to look into your example. I am still busy right now.

What I can say, if the debug is : failed to share gl context, make sure that the Qt GL context is not current in any thread when sharing it with gstreamer. (see cluttershare and sdlshare (from git) examples to see how to do that)

Sincerely
Julien


2009/11/4 Andrey Nechypurenko <[hidden email]>
Hi Folks,

I am currently working on Qt-based application which uses OpenGL context (texture) sharing technique to display video on 3D scene. I am using approach similar to the one implemented in cluttershare example from gst-plugins-gl. Currently it runs on Linux but does not work on Windows. I believe that the reason is that context sharing between Qt and Gstreamer does not work. According to the documentation, only contexts with the same pixel format could be shared. That is why I was looking for the way to query pixel format used with GL context created by gst-gl plugin and did not found it yet. I guess it just does not exists :-) .

So the question I would like to ask is whether it would make sense to add some kind of API to make it easier to access GL context created? For example, it could be callback set via certain property which is called right after the initialization step and provide corresponding handles (HWND, HDC, HGLRC or any other platform-specific handles similar to those stored in _GstGLWindowPrivate structure) which could be used with platform and GL API to query required information?

I would also appreciate any comments or pointers to the possible solution directions without extending the property set or API.

Regards,
Andrey.




------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Querying GL context pixel format

Andrey Nechypurenko
Hi,

> set GST_GL_WINDOW_DEBUG=1
> before launching the pipeline, it should output some debug informations about
> success or failure when sharing gl contexts.

Sorry for such a question, but where this output goes on Windows? I do not see anything neither in console nor in MSVC output window where debug messages are usually printed. Or maybe it is because I am using "release" version of gstreamer DLLs?

> I had no time to look into your example. I am still busy right now.

No problem. I've learned a lot trying to fix the problem myself and proud that it works at least on Linux :-) .
None of these would happen if you fixed the error earlier :-) .

> What I can say, if the debug is : failed to share gl context, make sure that the
> Qt GL context is not current in any thread when sharing it with gstreamer. (see cluttershare
> and sdlshare (from git) examples to see how to do that)

Well, I am explicitly calling wglMakeCurrent(0, 0); before initializing gstreamer to unset Qt context. Since it also works on Linux, I assume that the initialization sequence is correct. That is why I was looking for other reasons which might prevent context sharing, i.e. different pixel formats.

Nevertheless, is not it a kind of co-accidence that on Linux Qt initializes the context in exactly the same way as gstreamer does? And do not you think that the more robust way would be to query the context created by gstreamer and explicitly instruct Qt (or whatever other library) to create the same context format to ensure that sharing will work? If yes, then the corresponding API or callback might be necessary as I mentioned in my previous email.

Sincerely,
Andrey.


2009/11/4 Andrey Nechypurenko <[hidden email]>

>Hi Folks,
>
>>I am currently working on Qt-based application which uses OpenGL context (texture) sharing technique to display video on 3D scene. I am using approach similar to the one implemented in cluttershare example from gst-plugins-gl. Currently it runs on Linux but does not work on Windows. I believe that the reason is that context sharing between Qt and Gstreamer does not work. According to the documentation, only contexts with the same pixel format could be shared. That is why I was looking for the way to query pixel format used with GL context created by gst-gl plugin and did not found it yet. I guess it just does not exists :-) .
>
>>So the question I would like to ask is whether it would make sense to add some kind of API to make it easier to access GL context created? For example, it could be callback set via certain property which is called right after the initialization step and provide corresponding handles (HWND, HDC, HGLRC or any other platform-specific handles similar to those stored in _GstGLWindowPrivate structure) which could be used with platform and GL API to query required information?
>
>>I would also appreciate any comments or pointers to the possible solution directions without extending the property set or API.
>
>>Regards,
>>Andrey.
>
>
>
>
>>------------------------------------------------------------------------------
>>Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
>>trial. Simplify your report design, integration and deployment - and focus on
>>what you do best, core application coding. Discover what's new with
>>Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>>_______________________________________________
>>gstreamer-devel mailing list
>[hidden email]
>https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>



     

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Querying GL context pixel format

Julien Isorce


2009/11/4 Andrey Nechypurenko <[hidden email]>
Hi,

> set GST_GL_WINDOW_DEBUG=1
> before launching the pipeline, it should output some debug informations about
> success or failure when sharing gl contexts.

Sorry for such a question, but where this output goes on Windows? I do not see anything neither in console nor in MSVC output window where debug messages are usually printed. Or maybe it is because I am using "release" version of gstreamer DLLs?

open a console then just type:  set GST_GL_WINDOW_DEBUG=1
(as you can also do: set GST_DEBUG=gldisplay:3
and
set GST_GL_SHADER_DEBUG=1)
then enter your pipeline as usually.

have you tried this build http://www.gstreamer-winbuild.ylatuya.es/doku.php?id=download ?
The debug works with this build.

> I had no time to look into your example. I am still busy right now.

No problem. I've learned a lot trying to fix the problem myself and proud that it works at least on Linux :-) .
None of these would happen if you fixed the error earlier :-) .


 

> What I can say, if the debug is : failed to share gl context, make sure that the
> Qt GL context is not current in any thread when sharing it with gstreamer. (see cluttershare
> and sdlshare (from git) examples to see how to do that)

Well, I am explicitly calling wglMakeCurrent(0, 0); before initializing gstreamer to unset Qt context. Since it also works on Linux, I assume that the initialization sequence is correct. That is why I was looking for other reasons which might prevent context sharing, i.e. different pixel
formats.
No pb about pixel format because it the same screen. So even if the input values are differents then the s&ame is choosen. Something like that.
 

Nevertheless, is not it a kind of co-accidence that on Linux Qt initializes the context in exactly the same way as gstreamer does? And do not you think that the more robust way would be to query the context created by gstreamer and explicitly instruct Qt (or whatever other library) to create the same context format to ensure that sharing will work? If yes, then the corresponding API or callback might be necessary as I mentioned in my previous email.

Actually I think it's just a symetric pb. But it could be a possibility.
Well about the pb, on window the sharing can be done after context creation, (on linux, it's done when creating a context)
but bettween the creation and the sharing, no texture, no shaders, no fbo or nothing else must be created before sharing the 2 contexts.
(that's why the possibility the share the gl context after the creation has (as far as i know) no sense.
Anyway, you could use on opengl debugger and see if on windows, qt is creating a texture or anyelse before sharing it.

Sincerely
Julien


Sincerely,
Andrey.


2009/11/4 Andrey Nechypurenko <[hidden email]>

>Hi Folks,
>
>>I am currently working on Qt-based application which uses OpenGL context (texture) sharing technique to display video on 3D scene. I am using approach similar to the one implemented in cluttershare example from gst-plugins-gl. Currently it runs on Linux but does not work on Windows. I believe that the reason is that context sharing between Qt and Gstreamer does not work. According to the documentation, only contexts with the same pixel format could be shared. That is why I was looking for the way to query pixel format used with GL context created by gst-gl plugin and did not found it yet. I guess it just does not exists :-) .
>
>>So the question I would like to ask is whether it would make sense to add some kind of API to make it easier to access GL context created? For example, it could be callback set via certain property which is called right after the initialization step and provide corresponding handles (HWND, HDC, HGLRC or any other platform-specific handles similar to those stored in _GstGLWindowPrivate structure) which could be used with platform and GL API to query required information?
>
>>I would also appreciate any comments or pointers to the possible solution directions without extending the property set or API.
>
>>Regards,
>>Andrey.
>
>
>
>
>>------------------------------------------------------------------------------
>>Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
>>trial. Simplify your report design, integration and deployment - and focus on
>>what you do best, core application coding. Discover what's new with
>>Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>>_______________________________________________
>>gstreamer-devel mailing list
>[hidden email]
>https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>





------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Querying GL context pixel format

Andrey Nechypurenko
>>>> set GST_GL_WINDOW_DEBUG=1
>>>> before launching the pipeline, it should output some debug
>>>> informations about
>>>> success or failure when sharing gl contexts.
>>
>>Sorry for such a question, but where this output goes on
>>Windows? I do not see anything neither in console nor in MSVC
>>output window where debug messages are usually printed. Or maybe
>>it is because I am using "release" version of gstreamer DLLs?
>
>open a console then just type:  set GST_GL_WINDOW_DEBUG=1
>(as you can also do: set GST_DEBUG=gldisplay:3
>and
>set GST_GL_SHADER_DEBUG=1)
>then enter your pipeline as usually.

Hmm... My self-compiled gst-launch actually generates debug
output, but my GUI application not.

>have you tried this build
>http://www.gstreamer-winbuild.ylatuya.es/doku.php?id=download ?
>The debug works with this build.

I built it myself as they described here:
http://www.gstreamer-winbuild.ylatuya.es/doku.php?id=developers

>>> What I can say, if the debug is : failed to share gl context,
>>> make sure that the
>>> Qt GL context is not current in any thread when sharing it
>>> with gstreamer. (see cluttershare

>>> and sdlshare (from git) examples to see how to do that)
>
>>Well, I am explicitly calling wglMakeCurrent(0, 0); before
>>initializing gstreamer to unset Qt context. Since it also works
>>on Linux, I assume that the initialization sequence is
>>correct. That is why I was looking for other reasons which might
>>prevent context sharing, i.e. different pixel formats.
>
>No pb about pixel format because it the same screen. So even if
>the input values are differents then the s&ame is
>choosen. Something like that.

Ok. I see.

>>Nevertheless, is not it a kind of co-accidence that on Linux Qt
>>initializes the context in exactly the same way as gstreamer
>>does? And do not you think that the more robust way would be to
>>query the context created by gstreamer and explicitly instruct
>>Qt (or whatever other library) to create the same context format
>>to ensure that sharing will work? If yes, then the corresponding
>>API or callback might be necessary as I mentioned in my previous
>>email.
>
>Actually I think it's just a symetric pb. But it could be a
>possibility.  
>Well about the pb, on window the sharing can be done after
>context creation, (on linux, it's done when creating a context)
>but bettween the creation and the sharing, no texture, no
>shaders, no fbo or nothing else must be created before sharing
>the 2 contexts. (that's why the possibility the share the gl
>context after the creation has (as far as i know) no sense.
>Anyway, you could use on opengl debugger and see if on windows,
>qt is creating a texture or anyelse before sharing it.

Thanks for the explanations. I will continue investigating what
is going on.

Regards,
Andrey.


     

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Querying GL context pixel format

Andrey Nechypurenko
>>>> set GST_GL_WINDOW_DEBUG=1

>>>> before launching the pipeline, it should output some debug
>>>> informations about
>>>> success or failure when sharing gl contexts.
>>
>>Sorry for such a question, but where this output goes on
>>Windows? I do not see anything neither in console nor in MSVC
>>output window where debug messages are usually printed. Or maybe
>>it is because I am using "release" version of gstreamer DLLs?
>
>open a console then just type:  set GST_GL_WINDOW_DEBUG=1
>(as you can also do: set GST_DEBUG=gldisplay:3
>and
>set GST_GL_SHADER_DEBUG=1)
>then enter your pipeline as usually.
>
> Hmm... My self-compiled gst-launch actually generates debug
> output, but my GUI application not.

Adding CONFIG += console in .pro file got back the stdout. So now I
can see the following messages:

GstGLWindow-DEBUG: WM_CREATE
GstGLWindow-DEBUG: gl context created: 196608d
GstGLWindow-DEBUG: failed to share opengl context 196608d with 65537d
GstGLWindow-DEBUG: gl window created: 330264d
GstGLWindow-DEBUG: begin loop

So it seams like the problem is really with context sharing on Windows.


     

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Querying GL context pixel format

Julien Isorce
have you checked that the sdlshare or cluttershare examples are working on your win32 environment ?
(works on mine)


2009/11/4 Andrey Nechypurenko <[hidden email]>
>>>> set GST_GL_WINDOW_DEBUG=1

>>>> before launching the pipeline, it should output some debug
>>>> informations about
>>>> success or failure when sharing gl contexts.
>>
>>Sorry for such a question, but where this output goes on
>>Windows? I do not see anything neither in console nor in MSVC
>>output window where debug messages are usually printed. Or maybe
>>it is because I am using "release" version of gstreamer DLLs?
>
>open a console then just type:  set GST_GL_WINDOW_DEBUG=1
>(as you can also do: set GST_DEBUG=gldisplay:3
>and
>set GST_GL_SHADER_DEBUG=1)
>then enter your pipeline as usually.
>
> Hmm... My self-compiled gst-launch actually generates debug
> output, but my GUI application not.

Adding CONFIG += console in .pro file got back the stdout. So now I
can see the following messages:

GstGLWindow-DEBUG: WM_CREATE
GstGLWindow-DEBUG: gl context created: 196608d
GstGLWindow-DEBUG: failed to share opengl context 196608d with 65537d
GstGLWindow-DEBUG: gl window created: 330264d
GstGLWindow-DEBUG: begin loop

So it seams like the problem is really with context sharing on Windows.




------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Querying GL context pixel format

Andrey Nechypurenko
Hi,

The glupload/Qt texture sharing example works now.
Thanks to all of you answered to my questions.

I submit the Bug 600797 with attached sources. Now GL plugin
developers can decide whether to include this example in
gst-plugins-gl/tests/examples/qt ;-) .


Regards,
Andrey.


________________________________
From: Julien Isorce <[hidden email]>
To: Discussion of the development of GStreamer <[hidden email]>
Sent: Wed, November 4, 2009 5:54:05 PM
Subject: Re: [gst-devel] Querying GL context pixel format

have you checked that the sdlshare or cluttershare examples are working on your win32 environment ?
(works on mine)



2009/11/4 Andrey Nechypurenko <[hidden email]>

>>>> set GST_GL_WINDOW_DEBUG=1
>
>>>>>> before launching the pipeline, it should output some debug
>>>>>> informations about
>>>>>> success or failure when sharing gl contexts.
>>>>
>>>>Sorry for such a question, but where this output goes on
>>>>Windows? I do not see anything neither in console nor in MSVC
>>>>output window where debug messages are usually printed. Or maybe
>>>>it is because I am using "release" version of gstreamer DLLs?
>>>
>>>open a console then just type:  set GST_GL_WINDOW_DEBUG=1
>>>(as you can also do: set GST_DEBUG=gldisplay:3
>>>and
>>>set GST_GL_SHADER_DEBUG=1)
>>>then enter your pipeline as usually.
>>>
>>> Hmm... My self-compiled gst-launch actually generates debug
>>> output, but my GUI application not.
>
>Adding CONFIG += console in .pro file got back the stdout. So now I
>>can see the following messages:
>
>>GstGLWindow-DEBUG: WM_CREATE
>>GstGLWindow-DEBUG: gl context created: 196608d
>>GstGLWindow-DEBUG: failed to share opengl context 196608d with 65537d
>>GstGLWindow-DEBUG: gl window created: 330264d
>>GstGLWindow-DEBUG: begin loop
>
>>So it seams like the problem is really with context sharing on Windows.
>
>
>
>
>
>>------------------------------------------------------------------------------
>>Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
>>trial. Simplify your report design, integration and deployment - and focus on
>>what you do best, core application coding. Discover what's new with
>>Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>>_______________________________________________
>>gstreamer-devel mailing list
>[hidden email]
>https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>



     

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel