Pbuffer + shader

I have the pbuffer working well
I have shaders working well

But I can’t for the life of me get it to render into the pbuffer while using a shader.

The rendering context on the pbuffer is different than the one the window normally uses.

I can use shading and pbuffers just fine if the shaders are attached to the window’s rendering context. I can not get them to attach to the pbuffer’s context though. Is it possible? It must be…

I’m so confused, I’m even willing to send my code if someone has the time.

–Joseph

So…right after posting, I figured out what was wrong. Sorry I jumped the gun. I can’t seem to delete this post.

–Joseph

what was wrong?tell me please:)

Forgot wglShareList() I guess? :slight_smile:

What was wrong?

I wasn’t used to programming with multiple rendering contexts.

The p-buffer has a context and there is the “regular context”, which just renders to the window normally. So, I was creating my shaders when in the regular context, and it should have been in the pbuffer’s context. Likewise, I wasn’t careful when reshaping the window, changing the display settings, etc.

So, a pbuffer context can have shaders, extensions, and other things, you just now have another state variable to consider…which context you are in. Just because the main window is using a depth test doesn’t mean that the pbuffer is, and shaders are also, it seems, not shared between contexts. Too bad :frowning: Tha’d be a cool feature.

I guess you guys already know about that stuff, but it is just a thing I hadn’t considered, not hard once you know what is going on. Like too many quirky things in programming, no?

–Joseph

Shaders should be shared across rendering contexts if you use wglShareLists.

Shaders should be shared across rendering contexts if you use wglShareLists :eek: ?

but wglShareLists is effect display-list ,no Shaders…is it???

wglShareLists shares all potentially large objects: display lists, shaders, textures and buffer objects.

Where is the wglsharelists thing documented? I only see that it shares display lists.

Wow! To be able to share all that stuff is very nice! Hmm, there is still some rendering context management that must be done, but probably less.

Good to share display lists, since I’m using high-poly models. It totally makes sense to have a function like this!

–Joseph

wglShareLists() shares not only display lists but shaders, textures, VBOs etc. as Daniel Wesslen mentioned. The docs in MSDN are just quite outdated. You still need to keep track of different states between the contexts though.

Originally posted by Joseph19:
[b]Where is the wglsharelists thing documented? I only see that it shares display lists.

–Joseph[/b]
me too.I think opengl 's document is penury :confused:
where are you find the wglsharelists 's define? :rolleyes:

I don’t think there is a single place for wglShareLists as it is a Windows only call and does not exist in the main OpenGL docs. (And hence MS has not updated their docs since 1.1 days)

However, if you look in the VBO/ARB VP/FP and other specs, you will see reference to if the new object type is shared in the same way as display lists.

(ie goto
http://oss.sgi.com/projects/ogl-sample/registry/ARB/vertex_buffer_object.txt
and search for “share”)

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.