• Advertisement
Sign in to follow this  

Register combiner code

This topic is 4550 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
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
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.

Share this post


Link to post
Share on other sites
I tried the stuff from the comment as well but the code does probably more than that, my results weren't the same. I never used combiners as they're getting old, that's why I asked if someone could translate it. I know, its not very nice. Anyway, thanks for the link!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement