// 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
Register combiner code
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?
Not many people will be willing to translate code for you. The GL_NV_register_combiners spec should help you out.
Judging by the comments it looks like it's just
Judging by the comments it looks like it's just
col*tex0 + (1-col)*tex1 + tex2
but keep in mind that I've never used register combiners so that could be way off. I recommend reading the spec.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement