Advertisement

Multiple CG Vertex Shaders ?

Started by January 19, 2004 10:43 PM
2 comments, last by Tree Penguin 21 years, 1 month ago
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 ).
cgGLBindProgram

| - My (new) little website - | - email me - |
Advertisement
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).
I got it working i shared variables, which appearently isn''t valid and i had invalid code in the shader what made the whole object disappear.

This topic is closed to new replies.

Advertisement