Sign in to follow this  
spek

Register combiner code

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this