Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Sharing display lists between rendering contexts (wglShareLists)???

520 views
Skip to first unread message

Dr. Daniel Düring

unread,
Aug 2, 2000, 3:00:00 AM8/2/00
to
Hi all,

I am trying to use wglShareLists of Windows OpenGL implementation in order
to make display lists of fonts available to the rendering contexts of both
my main View and a separate Thread for scene animation.

This does not work, although sharing across threads (as opposed to
processes) is allowed.

Any ideas, experiences or code fragments?
Thanx,
Daniel

Ron Fosner

unread,
Aug 2, 2000, 3:00:00 AM8/2/00
to
From MSDN....

"You can only share display lists with rendering contexts within the same
process. However, not all rendering contexts in a process can share display
lists. Rendering contexts can share display lists only if they use the same
implementation of OpenGL functions. All client rendering contexts of a given
pixel format can always share display lists."

This makes sense since each process has it's own 4Gig address space. I've
successfully used wglShareLists with display lists and texture objects in
the same process, but never with different ones.

Ron


"Dr. Daniel Düring" <NOSPAM...@meteo-graphics.de> wrote in message
news:8m9942$h9i$1...@unlisys.unlisys.net...

Dr. Daniel Düring

unread,
Aug 4, 2000, 3:00:00 AM8/4/00
to
I am trying to use wglShareLists for two threads within the same process. So
it should work...but it does not. Did you also share between threads and if
so, could you send me some coding example for cross-referencing.

Thank you very much,
Daniel


Ron Fosner <r...@lifefx.com> schrieb in im Newsbeitrag:
3989a017$0$23...@wodc7nh6.news.uu.net...

Andrew F. Vesper

unread,
Aug 4, 2000, 3:00:00 AM8/4/00
to
"Dr. Daniel Düring" wrote:

> I am trying to use wglShareLists for two threads within the same process.

Do you mean you are trying to have two threads, each with their own OpenGL
context, sharing the display lists and texture objects? Remember to call
wglMakeCurrent() in each thread, specifying the context that belongs to
that thread.

Tell us more precisely what you are doing, and what errors you are getting.
--
Andy V (OpenGL Alpha Geek)
"In order to make progress, one must leave the door to the unknown ajar."
Richard P. Feynman, quoted by Jagdish Mehra in _The Beat of a Different Drum_.

Paul Martz's OpenGL FAQ: http://www.opengl.org/About/FAQ/Technical.html

Ruud van Gaal

unread,
Aug 7, 2000, 3:00:00 AM8/7/00
to
On Fri, 04 Aug 2000 21:23:57 -0400, "Andrew F. Vesper"
<ave...@wn.net> wrote:

>"Dr. Daniel Düring" wrote:
>
>> I am trying to use wglShareLists for two threads within the same process.
>
>Do you mean you are trying to have two threads, each with their own OpenGL
>context, sharing the display lists and texture objects? Remember to call
>wglMakeCurrent() in each thread, specifying the context that belongs to
>that thread.

If he is, then he should stop doing it and put the OpenGL calls in the
same thread, if possible. (oh, it's faster that way)

>Tell us more precisely what you are doing, and what errors you are getting.

Ruud van Gaal, GPL Rank +53.53
MarketGraph / MachTech: http://www.marketgraph.nl
Pencil art: http://www.marketgraph.nl/gallery

Dr. Daniel Düring

unread,
Aug 7, 2000, 3:00:00 AM8/7/00
to
My main OpenGL view displays the (static) scene for some fixed moment in
time. Alternatively, the application can animate the scene in the same
window. This animation is handled in a separate worker thread (one reason
for this is to keep the main application ready for input). I want to avoid
recalculating the displaylist when switching between static and animated
view mode.

The main application and the workerthread each have their own rendering
context. The former is constant, the latter is created
(wglCreateContext/wglMakeCurrent) and destroyed (wglDeleteContext) as
animation mode is entered or left.

Unfortunately no displaylist objects are shown.

Daniel

Andrew F. Vesper <ave...@wn.net> schrieb in im Newsbeitrag:
398B6CAD...@wn.net...


> "Dr. Daniel Düring" wrote:
>
> > I am trying to use wglShareLists for two threads within the same
process.
>
> Do you mean you are trying to have two threads, each with their own OpenGL
> context, sharing the display lists and texture objects? Remember to call
> wglMakeCurrent() in each thread, specifying the context that belongs to
> that thread.
>

> Tell us more precisely what you are doing, and what errors you are
getting.

Dr. Daniel Düring

unread,
Aug 7, 2000, 3:00:00 AM8/7/00
to
Addendum:

Both rendering contexts are created with regard to the same device context
handle and thus the same pixel format. The return value of wglShareLists is
1 (TRUE), but no display list objects are drawn.

Dr. Daniel Düring <NOSPAM...@meteo-graphics.de> schrieb in im
Newsbeitrag: 8mmfep$iv5$1...@unlisys.unlisys.net...

John Williams

unread,
Aug 7, 2000, 3:00:00 AM8/7/00
to

"Dr. Daniel Düring" wrote:

> Addendum:
>
> Both rendering contexts are created with regard to the same device context
> handle and thus the same pixel format. The return value of wglShareLists is
> 1 (TRUE), but no display list objects are drawn.

Make sure that you call wglShareLists before any display lists are created by
the context which is going to share the lists (it is in the spec for
wglShareLists).
Some OpenGL drivers don't care about this but some do.


John Williams
QualECAD

Dr. Daniel Düring

unread,
Aug 8, 2000, 3:00:00 AM8/8/00
to
Thanks very much, this was it!
BOTH rendering contexts have to be empty before calling wglShareLists. From
MSDN documentation I got the impression, only one has to be empty. Anyway,
it works fine now.

Daniel
John Williams <john.w...@alumni.stanford.org> schrieb in im Newsbeitrag:
398ED864...@alumni.stanford.org...

0 new messages