2 program shaders
by Skylar Kelty · in Torque Game Engine · 05/06/2006 (4:32 am) · 3 replies
CgVertexProgram = cgCreateProgramFromFile( cgContext, CG_SOURCE, "./cg/water_vp11.cg", cgVertexProfile, NULL, NULL);this is in fluidrender.cc
but I also want
cgVertexProgram = cgCreateProgramFromFile( cgContext, CG_SOURCE, "./cg/2TUfp20dot3.cg", cgVertexProfile, NULL, NULL);However that is then two programs and i don't think they would work happily together even though they compile
Basically I would like the updated water and bump mapped interiors working together any idea on how to do this?
About the author
#2
Thanks to Alan James
You'll initialize the shaders in exactly the same way as described in the source.
05/06/2006 (10:33 pm)
In the Cg Water thread this is already explained.Quote:@Stefan
What I did was rename the cgContex, cgVertexProgram, etc. in interiorRender.cc to cgContexInterior, cgVertexProgramInterior, etc. Below is an example section of code. *IT IS NOT* every change that has to be made, just do a find and replace and make sure you have case sensetive on, when you do. What I did was change one at a time, save then compile to confirm that I had eliminated an error.
bool bCallBackSetInterior =false; bool gotNumMaps = false; boolcg_enableInterior = true;// Toggle Cg Program On / Off TextureHandlenormalHandleInterior; CGcontextcgContextInterior;// A Context To Hold Our Cg Program CGprogramcgVertexProgramInterior,// Our Cg Vertex Program cgFragProgramInterior;// Our Cg Fragment Program CGprofilecgVertexProfileInterior,// The Profile To Use For Our Vertex Shader cgFragProfileInterior;// The Profile To Use For Our Frag Shader CGparameterpositionInterior, VertexColorInterior,colorInterior, modelViewMatrixInterior, KdParamInterior;// The Parameters Needed For Our Shader(s)
When you've eliminated each duplicate you should have one final error, that will refer to "initShader". Just do another find/replace in the fluidRender.cc, replacing "initShader" with "initShaderFluid". As you may note in the thread above with my conversation with Alex, this is *ALL* a bit of a hack, but it works.
Thanks to Alan James
You'll initialize the shaders in exactly the same way as described in the source.
#3
05/07/2006 (12:04 pm)
Thanks Mincetro
Torque Owner Skylar Kelty
SkylarK
cgVertexProgram = cgCreateProgramFromFile( cgContext,
CG_SOURCE,
"./cg/*.*",
cgVertexProfile,
NULL,
NULL);