Beispiel #1
0
void InitChromaticTwin1States()
{
	//Set up the register combiners
	glCombinerParameteriNV(GL_NUM_GENERAL_COMBINERS_NV, 1);

	//Disable per-stage constants if we have been using them
	if(NV_register_combiners2_supported)
		glDisable(GL_PER_STAGE_CONSTANTS_NV);

	//Send (0, 1, 0, 0) and (0, 0, 1, 0) as constant colors
	GLfloat constant0[]={0.0f, 1.0f, 0.0f, 0.0f};
	glCombinerParameterfvNV(GL_CONSTANT_COLOR0_NV, constant0);
	GLfloat constant1[]={0.0f, 0.0f, 1.0f, 0.0f};
	glCombinerParameterfvNV(GL_CONSTANT_COLOR1_NV, constant1);

	//Combiner 0 does:	green(tex1)+blue(tex0)->spare0.rgb
	glCombinerInputNV(	GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_A_NV, GL_TEXTURE1_ARB,
						GL_UNSIGNED_IDENTITY_NV, GL_RGB);
	glCombinerInputNV(	GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_B_NV, GL_CONSTANT_COLOR0_NV,
						GL_UNSIGNED_IDENTITY_NV, GL_RGB);
	glCombinerInputNV(	GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_C_NV, GL_TEXTURE0_ARB,
						GL_UNSIGNED_IDENTITY_NV, GL_RGB);
	glCombinerInputNV(	GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_D_NV, GL_CONSTANT_COLOR1_NV,
						GL_UNSIGNED_IDENTITY_NV, GL_RGB);
	glCombinerOutputNV(	GL_COMBINER0_NV, GL_RGB, GL_DISCARD_NV, GL_DISCARD_NV, GL_SPARE0_NV,
						GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE);

	glFinalCombinerInputNV(GL_VARIABLE_A_NV, GL_PRIMARY_COLOR_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
	glFinalCombinerInputNV(GL_VARIABLE_B_NV, GL_ZERO, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
	glFinalCombinerInputNV(GL_VARIABLE_C_NV, GL_SPARE0_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
	glFinalCombinerInputNV(GL_VARIABLE_D_NV, GL_ZERO, GL_UNSIGNED_IDENTITY_NV, GL_RGB);

	//Bind vertex program
	glBindProgramNV(GL_VERTEX_PROGRAM_NV, chromaticTwin1VP);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_NVRegisterCombiners_nglCombinerParameterfvNV(JNIEnv *env, jclass clazz, jint pname, jobject params, jint params_position, jlong function_pointer) {
	const GLfloat *params_address = ((const GLfloat *)(*env)->GetDirectBufferAddress(env, params)) + params_position;
	glCombinerParameterfvNVPROC glCombinerParameterfvNV = (glCombinerParameterfvNVPROC)((intptr_t)function_pointer);
	glCombinerParameterfvNV(pname, params_address);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_NVRegisterCombiners_nglCombinerParameterfvNV(JNIEnv *env, jclass clazz, jint pname, jlong params, jlong function_pointer) {
	const GLfloat *params_address = (const GLfloat *)(intptr_t)params;
	glCombinerParameterfvNVPROC glCombinerParameterfvNV = (glCombinerParameterfvNVPROC)((intptr_t)function_pointer);
	glCombinerParameterfvNV(pname, params_address);
}