PDA

View Full Version : Cg and Opengl Rendering Contexts



pocketmoon
09-21-2002, 10:55 PM
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.

Asgard
09-22-2002, 06:56 AM
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).]