SFML community forums

Help => Graphics => Topic started by: slotdev on January 31, 2013, 05:11:41 pm

Title: OpenGL context for each RenderTexture?
Post by: slotdev on January 31, 2013, 05:11:41 pm
Hi

We use an older version of SFML 2.0 (from 09/10/2011 - we will hopefully be updating soon!) and my question is about RenderTexture. Is a new OpenGL context created for each RenderTexture object?

We have offscreen textures, so I am right in saying each of these has a context? Is there any way to know which contexts are for offscreen textures, and which are the real screen??

I hope this makes sense. It is way over my knowledge of OpenGL.

Thanks
Ed

Title: Re: OpenGL context for each RenderTexture?
Post by: Laurent on January 31, 2013, 05:21:32 pm
Quote
I am right in saying each of these has a context?
Yes.

Quote
Is there any way to know which contexts are for offscreen textures, and which are the real screen??
??
What do you want to do?
Title: Re: OpenGL context for each RenderTexture?
Post by: slotdev on January 31, 2013, 05:27:10 pm
Thanks Laurent.

Basically, another program "hook" has to hijack our OpenGL context and take control of it for a time, rendering stuff and at the moment, because we use offscreen textures, there is no way for the hook to know which is the real screen, and which is our offscreen texture.

So, either we need to know which is which, or not use any offscreen textures (which is probably impossible for us as we do some quite advanced things).

Thanks
Ed
Title: Re: OpenGL context for each RenderTexture?
Post by: Laurent on January 31, 2013, 05:31:00 pm
I don't know how you're supposed to tell the other app which is what, but if you bind (setActive(true)) a render-target's context, and then call wgl/glx/agl/GetCurrentContext() then you'll get a direct pointer to it. Is that what you need?
Title: Re: OpenGL context for each RenderTexture?
Post by: slotdev on January 31, 2013, 05:34:53 pm
I hope so - I am kind of stuck in the middle. Thanks for the help :)