Original Post
Could someone translate this code to... Cg/GLSL/C or something? This code is like magic in arab to me so could somebody please help me out?
// Use 1 combiner
glCombinerParameteriNV(GL_NUM_GENERAL_COMBINERS_NV, 1);
// General combiner 0, RGB portion
glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_A_NV,
GL_PRIMARY_COLOR_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_B_NV,
GL_TEXTURE0_ARB, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_C_NV,
GL_TEXTURE1_ARB, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
glCombinerInputNV(GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_D_NV,
GL_TEXTURE2_ARB, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
// spare0rgb = modulate(texture0, texture1);
glCombinerOutputNV(GL_COMBINER0_NV, GL_RGB, GL_SPARE0_NV, GL_SPARE1_NV,
GL_DISCARD_NV, scale2, GL_NONE, GL_FALSE, GL_FALSE,
GL_FALSE);
// Final combiner, RGB portion (Output = AB + (1-A)C + D)
glFinalCombinerInputNV(GL_VARIABLE_A_NV, GL_SPARE0_NV,
GL_UNSIGNED_IDENTITY_NV, GL_RGB);
glFinalCombinerInputNV(GL_VARIABLE_B_NV, GL_SPARE1_NV,
GL_UNSIGNED_IDENTITY_NV, GL_RGB);
// C = Outputs of general combiners
glFinalCombinerInputNV(GL_VARIABLE_C_NV, GL_ZERO,
GL_UNSIGNED_IDENTITY_NV, GL_RGB);
// ADD specular map if necessary
if(param == PARAM_OHI_H) {
glFinalCombinerInputNV(GL_VARIABLE_D_NV, GL_TEXTURE3_ARB,
GL_UNSIGNED_IDENTITY_NV, GL_RGB);
} else {
glFinalCombinerInputNV(GL_VARIABLE_D_NV, GL_ZERO,
GL_UNSIGNED_IDENTITY_NV, GL_RGB);
}
Its used in a BRDF demo. The textures are most probably cubemaps. Greetings, Rick