Cg and Opengl Rendering Contexts

If I have more than one rendering context (pbuffer) which I want my shaders to run in do I need to :

  1. Call cgCreateContext’s , cgAddProgram, cgProgramByName, cgGLLoadProgram for each buffer ?

2)Call cgGLBindProgram/enable for each buffer ?

How do parameter binds operate between rendering contexts ?

Assuming of course that I want my shaders to run when I render to both contexts.

Rob J.

Vertex programs can be shared between OGL rendering contexts. So you don’t have to recreate them for all your pbuffers. Just call wglShareLists or use the additional context parameter when creating a context in GLX with all you contexts.

2)Call cgGLBindProgram/enable for each buffer ?

Since state is not shared between different contexts you’ll have to enable vertex program mode and bind the programs in each context.

How do parameter binds operate between rendering contexts ?

Parameters are different for each context, since they belong to the GL state, which isn’t shared.

Cheers.

[This message has been edited by Asgard (edited 09-22-2002).]