Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: OpenGL context for each RenderTexture?  (Read 1557 times)

0 Members and 1 Guest are viewing this topic.

slotdev

  • Sr. Member
  • ****
  • Posts: 385
    • View Profile
OpenGL context for each RenderTexture?
« 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

SFML 2.1

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: OpenGL context for each RenderTexture?
« Reply #1 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?
Laurent Gomila - SFML developer

slotdev

  • Sr. Member
  • ****
  • Posts: 385
    • View Profile
Re: OpenGL context for each RenderTexture?
« Reply #2 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
SFML 2.1

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: OpenGL context for each RenderTexture?
« Reply #3 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?
Laurent Gomila - SFML developer

slotdev

  • Sr. Member
  • ****
  • Posts: 385
    • View Profile
Re: OpenGL context for each RenderTexture?
« Reply #4 on: January 31, 2013, 05:34:53 pm »
I hope so - I am kind of stuck in the middle. Thanks for the help :)
SFML 2.1