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

Author Topic: opengl resources and context sharing  (Read 1930 times)

0 Members and 1 Guest are viewing this topic.

mercurio7891

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
opengl resources and context sharing
« on: April 12, 2011, 12:51:22 pm »
hi, is it possible for resources to be shared?? suppose I have one render context created on thread 1, and in thread 2 I attempt to do a glBindBuffer command etc. would it work??

regards

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
opengl resources and context sharing
« Reply #1 on: April 12, 2011, 01:31:59 pm »
I think you can, though I'd wait for Laurent to answer.
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
opengl resources and context sharing
« Reply #2 on: April 12, 2011, 01:32:55 pm »
All OpenGL contexts in SFML are shared.
Laurent Gomila - SFML developer

mercurio7891

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
opengl resources and context sharing
« Reply #3 on: April 12, 2011, 03:06:14 pm »
does that mean i need a dummy context in my worker thread for the sharing to work?? e.g
Code: [Select]

Thread1 (main thread):
create sfml window and main context
set main context as active
lock
draw vbo_one
unlock

Thread2 (worker thread):
create a dummy context and set it as active //is this step neccessary for sharing?
lock
update vbo_two and stuff
unlock


would it work if i don't have a dummy context? i.e just start calling gl calls on the worker thread, without creating a dummy context or setting any active context.

regards

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
opengl resources and context sharing
« Reply #4 on: April 12, 2011, 03:19:05 pm »
Quote
would it work if i don't have a dummy context? i.e just start calling gl calls on the worker thread, without creating a dummy context or setting any active context.

No, you always need an active context to call OpenGL functions.
Laurent Gomila - SFML developer

mercurio7891

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
opengl resources and context sharing
« Reply #5 on: April 12, 2011, 03:44:19 pm »
ahh thanks, i was hoping i could get away without the dummy context, as I was lazy and don't want to maintain a similar states across all context. :)

regards