Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: wglShareLists

  1. #1
    Junior Member Regular Contributor
    Join Date
    Jan 2001
    Location
    Israel
    Posts
    140

    wglShareLists

    Hi!

    I am trying to use wglShareLists in order to share textures between the pbuffer context and the window context. I define the texture in the pbuffer context (glTexImage2D), update it in the pbuffer context (glCopyTexSubImage2D) and then use it in the window context (glBindTexture). When I bind the texture nothing happens. The last binded texture stay binded.

    I chechked the documentation of the function, but it relates only to sharing display list, and doesn't mention the possibility of sharing textures.

    I call wglShareLists that way:
    wglShareLists(WindowRenderingContext, PBufferRenderingContext);

    any ideas why it doesn't work?

    Thanks,
    Shlomi.

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Jun 2001
    Location
    Denmark
    Posts
    607

    Re: wglShareLists

    I've had similar problems with wglShareLists - we even discussed it on this board.

    wglShareLists should also allow sharing of textures bwtween contexts. On ATI drivers it doesn't seem to have an effect. On NVIDIA drivers textures seem to be shared by default. We didn't get any of this confirmed by any of the driver writers.

  3. #3
    Senior Member OpenGL Guru knackered's Avatar
    Join Date
    Aug 2001
    Location
    UK
    Posts
    2,833

    Re: wglShareLists

    Why don't you use your window render context to draw into the pbuffer and copysubimage it into a texture?
    Your pbuffer doesn't have to have a seperate render context, only a device context.
    Maybe you know this already, and have another reason for doing it that way.
    I haven't checked the ogl wgl specs, but there doesn't seem to be much documentation on wglsharelists, even though it's an incredibly useful feature. All I can say is this - in MSDN it states that the context that is sharing its display lists should not contain any existing display lists when wglShareLists is called. Quite a limitation. The nvidia drivers seem to ignore this limitation (happily) - I've shared contexts textures with a newly created context AFTER the textures have been created.
    Knackered

  4. #4
    Junior Member Regular Contributor
    Join Date
    Jan 2001
    Location
    Israel
    Posts
    140

    Re: wglShareLists

    Hi,

    Thanks for your replies. I didn't know that I can use the window rendering context with the pbuffer. I have tried this, but it doesn't seem to work.

    I don't create a rendering context to the pbuffer, and when I make the bpuffer device context current I use the window rendering context.

    The problem is, that glCopyTexSubImage2D and glReadPixels (I have tried that too) generates a GL_INVALID_OPERATION error (for some reason they generates infinite number of errors).

    Maybe I should match the pbuffer pixel format to the window pixel format? How do I do that?

    BTW: I think it will be quite usefull to have a different rendering context for the pbuffer, because then you can easily set it's own matrixes and properties.

    Shlomi.

    [This message has been edited by Quaternion (edited 05-16-2002).]

  5. #5
    Junior Member Regular Contributor
    Join Date
    Jan 2001
    Location
    Israel
    Posts
    140

    Re: wglShareLists

    Hi,
    I set the stencil bits of the window to 0 and now it's working...

    knackered, I still don't think that it's a good idea to use the same rendering context for the window and the pbuffer... So, what about that wglShareLists?

    Shlomi.

  6. #6
    Senior Member OpenGL Guru knackered's Avatar
    Join Date
    Aug 2001
    Location
    UK
    Posts
    2,833

    Re: wglShareLists

    Well, yes, there are advantages to having seperate render contexts - such as keeping seperate render states (lighting, matrices etc.)...but, remember that when you switch from one context to another all the opengl states will have to be changed - unlike when you use the same context when you control what states need to change, and which don't.
    In other words, it's faster to use a single render context.
    I don't know what's wrong with wglShareLists for you (it works fine for me, but I don't use it much) - what card are you running it on?
    Knackered

  7. #7
    Junior Member Regular Contributor
    Join Date
    Jan 2001
    Location
    Israel
    Posts
    140

    Re: wglShareLists

    I use nVidia GeForce 2 Ultra.

  8. #8
    Junior Member Regular Contributor
    Join Date
    Jan 2001
    Location
    Israel
    Posts
    140

    Re: wglShareLists

    And one more thing, I can think of another good reason to use a different rendering context for the pbuffer. Let's say you want to use stencil in your window rendering, but don't want it in your pbuffer. You must set the stencil bits in the pbuffer pixel format, and that will be a waste of memory if you don't use them with the pbuffer.

  9. #9
    Senior Member OpenGL Guru knackered's Avatar
    Join Date
    Aug 2001
    Location
    UK
    Posts
    2,833

    Re: wglShareLists

    True. And you may also not want your pbuffer double buffered, or with a depth buffer.
    Ah well, keep plodding away at wglShareLists - write a simple test program to find out the problem.

    [This message has been edited by knackered (edited 05-17-2002).]
    Knackered

  10. #10
    Senior Member OpenGL Guru Humus's Avatar
    Join Date
    Mar 2000
    Location
    Stockholm, Sweden
    Posts
    2,345

    Re: wglShareLists

    Originally posted by PH:
    I've had similar problems with wglShareLists - we even discussed it on this board.

    wglShareLists should also allow sharing of textures bwtween contexts. On ATI drivers it doesn't seem to have an effect. On NVIDIA drivers textures seem to be shared by default. We didn't get any of this confirmed by any of the driver writers.
    What do you mean with "doesn't seem to have an effect" on ATi drivers? In my experience wglShareLists() works as expected and without any problems in ATi drivers.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •