
Multiple CG Vertex Shaders ?
I have implemented vertex shaders successfully for one vertex program. When i try to use multiple vertex shaders (still, only one vertex shader is used at a time) the objects disappear.
I use a part of the code of nehe''s lesson 47, does anyone know the proper way to use multiple vertex shaders (except loading and unloading cg completely every frame, that sucks
).

Well, i tried that and the objects disappear, i think it has to do with my loading. I now:
1. Create the CG Context
2. cgVertexProfile = cgGLGetLatestProfile(CG_GL_VERTEX)
3. cgGLSetOptimalOptions(cgVertexProfile)
4. cgProgram = cgCreateProgramFromFile(cgContext, CG_SOURCE, "CG/Water.cg", cgVertexProfile, "main", 0)
5. cgGLLoadProgram(cgProgram)
6. Init binding semantics (variables are shared with the other vertex shader.
7. Do step 4,5,6 again, with another program variable and a diffirent filename
Has it something to do with the fact the programs share the variables? Or is it something i forgot when initialising (error checking is also in my code, but it terminates the program if an error occurs).
1. Create the CG Context
2. cgVertexProfile = cgGLGetLatestProfile(CG_GL_VERTEX)
3. cgGLSetOptimalOptions(cgVertexProfile)
4. cgProgram = cgCreateProgramFromFile(cgContext, CG_SOURCE, "CG/Water.cg", cgVertexProfile, "main", 0)
5. cgGLLoadProgram(cgProgram)
6. Init binding semantics (variables are shared with the other vertex shader.
7. Do step 4,5,6 again, with another program variable and a diffirent filename
Has it something to do with the fact the programs share the variables? Or is it something i forgot when initialising (error checking is also in my code, but it terminates the program if an error occurs).
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement