예제 #1
0
void InitChromaticTwin2States()
{
	//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 (1, 0, 0, 0) as constant color 0
	GLfloat constant0[]={1.0f, 0.0f, 0.0f, 0.0f};
	glCombinerParameterfvNV(GL_CONSTANT_COLOR0_NV, constant0);
	
	//Combiner 0 does:	red(tex0)->spare0.rgb
	glCombinerInputNV(	GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_A_NV, GL_TEXTURE0_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);
	glCombinerOutputNV(	GL_COMBINER0_NV, GL_RGB, GL_SPARE0_NV, GL_DISCARD_NV, GL_DISCARD_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_TEXTURE1_ARB, 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, chromaticTwin2VP);

	//Enable blend to add to first pass
	glBlendFunc(GL_ONE, GL_ONE);
	glEnable(GL_BLEND);
}
예제 #2
0
void SetDiffuseDecalStates(void)
{
	//Bind textures
	//Unit 0 - normal map
	glEnable(GL_TEXTURE_2D);
	if(showBumps)
		glBindTexture(GL_TEXTURE_2D, normalMapTexture);
	else
		glBindTexture(GL_TEXTURE_2D, flatNormalMap);

	//Unit 1 - normalisation cube map
	glActiveTextureARB(GL_TEXTURE1_ARB);
	glEnable(GL_TEXTURE_CUBE_MAP_ARB);
	glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, normalisationCubeMap);

	//Unit 2 - decal map
	glActiveTextureARB(GL_TEXTURE2_ARB);
	glEnable(GL_TEXTURE_2D);
	glBindTexture(GL_TEXTURE_2D, decalTexture);
	glActiveTextureARB(GL_TEXTURE0_ARB);


	//Set up Register combiners
	//1 general combiner
	glCombinerParameteriNV(GL_NUM_GENERAL_COMBINERS_NV, 1);

	//combiner 0 does	tex0.rgb dot tex1.rgb -> spare0.rgb,
	glCombinerInputNV(	GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_A_NV, GL_TEXTURE0_ARB,
						GL_EXPAND_NORMAL_NV, GL_RGB);
	glCombinerInputNV(	GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_B_NV, GL_TEXTURE1_ARB,
						GL_EXPAND_NORMAL_NV, GL_RGB);
	
	glCombinerOutputNV(	GL_COMBINER0_NV, GL_RGB, GL_SPARE0_NV, GL_DISCARD_NV, GL_DISCARD_NV,
						GL_NONE, GL_NONE, GL_TRUE, GL_FALSE, GL_FALSE);

	//final combiner outputs spare0.rgb*texture2.rgb
	glFinalCombinerInputNV(GL_VARIABLE_A_NV, GL_SPARE0_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
	glFinalCombinerInputNV(GL_VARIABLE_B_NV, GL_TEXTURE2_ARB, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
	glFinalCombinerInputNV(GL_VARIABLE_C_NV, GL_ZERO, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
	glFinalCombinerInputNV(GL_VARIABLE_D_NV, GL_ZERO, GL_UNSIGNED_IDENTITY_NV, GL_RGB);

	glEnable(GL_REGISTER_COMBINERS_NV);

	//Set up vertex program
	glEnable(GL_VERTEX_PROGRAM_NV);
	glBindProgramNV(GL_VERTEX_PROGRAM_NV, diffuseDecalVertexProgram);
}
예제 #3
0
void GeneralFunctionStruct::Invoke(int stage, int portion, BiasScaleEnum bs)
{
    GLenum portionEnum = (RCP_RGB == portion) ? GL_RGB : GL_ALPHA;

    glCombinerInputNV(GL_COMBINER0_NV + stage,
        portionEnum,
        GL_VARIABLE_A_NV,
        op[0].reg[1].reg.bits.name,
        op[0].reg[1].map,
        MAP_CHANNEL(op[0].reg[1].reg.bits.channel));

    glCombinerInputNV(GL_COMBINER0_NV + stage,
        portionEnum,
        GL_VARIABLE_B_NV,
        op[0].reg[2].reg.bits.name,
        op[0].reg[2].map,
        MAP_CHANNEL(op[0].reg[2].reg.bits.channel));

    glCombinerInputNV(GL_COMBINER0_NV + stage,
        portionEnum,
        GL_VARIABLE_C_NV,
        op[1].reg[1].reg.bits.name,
        op[1].reg[1].map,
        MAP_CHANNEL(op[1].reg[1].reg.bits.channel));

    glCombinerInputNV(GL_COMBINER0_NV + stage,
        portionEnum,
        GL_VARIABLE_D_NV,
        op[1].reg[2].reg.bits.name,
        op[1].reg[2].map,
        MAP_CHANNEL(op[1].reg[2].reg.bits.channel));

    glCombinerOutputNV(GL_COMBINER0_NV + stage,
        portionEnum,
        op[0].reg[0].reg.bits.name,
        op[1].reg[0].reg.bits.name,
        op[2].reg[0].reg.bits.name,
        bs.bits.scale,
        bs.bits.bias,
        op[0].op,
        op[1].op,
        (op[2].op == RCP_MUX) ? true : false);
}
예제 #4
0
void InitChromaticSingleStates()
{
	//Set up the register combiners
	glCombinerParameteriNV(GL_NUM_GENERAL_COMBINERS_NV, 2);

	//Enable per stage constants
	glEnable(GL_PER_STAGE_CONSTANTS_NV);

	//Send (1, 0, 0, 0) and (0, 1, 0, 0) as combiner 0 constant colors
	GLfloat combiner0Constant0[]={1.0f, 0.0f, 0.0f, 0.0f};
	glCombinerStageParameterfvNV(GL_COMBINER0_NV, GL_CONSTANT_COLOR0_NV, combiner0Constant0);
	GLfloat combiner0Constant1[]={0.0f, 1.0f, 0.0f, 0.0f};
	glCombinerStageParameterfvNV(GL_COMBINER0_NV, GL_CONSTANT_COLOR1_NV, combiner0Constant1);

	//Send (0, 0, 1, 0) as combiner 1 constant color 0
	GLfloat combiner1Constant0[]={0.0f, 0.0f, 1.0f, 0.0f};
	glCombinerStageParameterfvNV(GL_COMBINER1_NV, GL_CONSTANT_COLOR0_NV, combiner1Constant0);

	//Combiner 0 does:	red(tex2)+green(tex1)->spare0.rgb
	glCombinerInputNV(	GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_A_NV, GL_TEXTURE2_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_TEXTURE1_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);

	//Combiner 1 does:	blue(tex0)+spare0.rgb->spare0.rgb
	glCombinerInputNV(	GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_A_NV, GL_TEXTURE0_ARB,
						GL_UNSIGNED_IDENTITY_NV, GL_RGB);
	glCombinerInputNV(	GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_B_NV, GL_CONSTANT_COLOR0_NV,
						GL_UNSIGNED_IDENTITY_NV, GL_RGB);
	glCombinerInputNV(	GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_C_NV, GL_SPARE0_NV,
						GL_UNSIGNED_IDENTITY_NV, GL_RGB);
	glCombinerInputNV(	GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_D_NV, GL_ZERO,
						GL_UNSIGNED_INVERT_NV, GL_RGB);
	glCombinerOutputNV(	GL_COMBINER1_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_TEXTURE3_ARB, 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, chromaticSingleVP);
}
예제 #5
0
//Set the states for texture attenuation
void SetTextureAttenStates()
{
    //Set up texture units
    //Unit 0 - decal texture
    glBindTexture(GL_TEXTURE_2D, decalTexture);
    //Unit 1 - 2D attenuation
    glActiveTextureARB(GL_TEXTURE1_ARB);
    glBindTexture(GL_TEXTURE_2D, atten2DTexture);
    //Unit 2 - 1D attenuation
    glActiveTextureARB(GL_TEXTURE2_ARB);
    glBindTexture(GL_TEXTURE_1D, atten1DTexture);
    glActiveTextureARB(GL_TEXTURE0_ARB);

    //Set up register combiners
    //one general combiner
    glCombinerParameteriNV(GL_NUM_GENERAL_COMBINERS_NV, 1);

    //combiner 0 does tex1+tex2 -> spare0
    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_ZERO,
                        GL_UNSIGNED_INVERT_NV, GL_RGB);
    glCombinerInputNV(	GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_C_NV, GL_TEXTURE2_ARB,
                        GL_UNSIGNED_IDENTITY_NV, GL_RGB);
    glCombinerInputNV(	GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_D_NV, GL_ZERO,
                        GL_UNSIGNED_INVERT_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);

    //final combiner outputs (1-spare0)*tex0*col0
    //first do tex0*col0 in the EF multiplier
    glFinalCombinerInputNV(GL_VARIABLE_E_NV, GL_TEXTURE0_ARB, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
    glFinalCombinerInputNV(GL_VARIABLE_F_NV, GL_PRIMARY_COLOR_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);

    //now do rest
    glFinalCombinerInputNV(GL_VARIABLE_A_NV, GL_SPARE0_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_E_TIMES_F_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
    glFinalCombinerInputNV(GL_VARIABLE_D_NV, GL_ZERO, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
}
예제 #6
0
//Set the states for pass through atten
void SetPassThroughAttenStates()
{
    //Set up texture units
    //Unit 0 - decal texture
    glBindTexture(GL_TEXTURE_2D, decalTexture);

    //Set up texture shaders
    //unit 0 - decal
    glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_TEXTURE_2D);
    //unit 1 - pass through atten coords
    glActiveTextureARB(GL_TEXTURE1_ARB);
    glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_PASS_THROUGH_NV);
    glActiveTextureARB(GL_TEXTURE0_ARB);


    //Set up register combiners
    //one general combiner
    glCombinerParameteriNV(GL_NUM_GENERAL_COMBINERS_NV, 1);

    //combiner 0 does tex1 dot tex1 -> spare0
    //spare 0 thus holds the squared length of the vector in tex1
    glCombinerInputNV(	GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_A_NV, GL_TEXTURE1_ARB,
                        GL_EXPAND_NORMAL_NV, GL_RGB);
    glCombinerInputNV(	GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_B_NV, GL_TEXTURE1_ARB,
                        GL_EXPAND_NORMAL_NV, GL_RGB);
    glCombinerOutputNV(	GL_COMBINER0_NV, GL_RGB, GL_SPARE0_NV, GL_DISCARD_NV, GL_DISCARD_NV,
                        GL_NONE, GL_NONE, GL_TRUE, GL_FALSE, GL_FALSE);

    //Set up final combiner to output clampto01(1-spare0)*col0*tex0
    //first do tex0*col0 in the EF multiplier
    glFinalCombinerInputNV(GL_VARIABLE_E_NV, GL_TEXTURE0_ARB, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
    glFinalCombinerInputNV(GL_VARIABLE_F_NV, GL_PRIMARY_COLOR_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);

    //now do rest
    glFinalCombinerInputNV(GL_VARIABLE_A_NV, GL_SPARE0_NV, GL_UNSIGNED_INVERT_NV, GL_RGB);
    glFinalCombinerInputNV(GL_VARIABLE_B_NV, GL_E_TIMES_F_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
    glFinalCombinerInputNV(GL_VARIABLE_C_NV, GL_ZERO, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
    glFinalCombinerInputNV(GL_VARIABLE_D_NV, GL_ZERO, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
}
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_NVRegisterCombiners_nglCombinerInputNV(JNIEnv *env, jclass clazz, jint stage, jint portion, jint variable, jint input, jint mapping, jint componentUsage, jlong function_pointer) {
	glCombinerInputNVPROC glCombinerInputNV = (glCombinerInputNVPROC)((intptr_t)function_pointer);
	glCombinerInputNV(stage, portion, variable, input, mapping, componentUsage);
}
예제 #8
0
void SetSimpleSpecularStates(void)
{
	//Bind textures
	//Unit 0 - normal map
	glEnable(GL_TEXTURE_2D);
	if(showBumps)
		glBindTexture(GL_TEXTURE_2D, normalMapTexture);
	else
		glBindTexture(GL_TEXTURE_2D, flatNormalMap);

	//Unit 1 - normalisation cube map
	glActiveTextureARB(GL_TEXTURE1_ARB);
	glEnable(GL_TEXTURE_CUBE_MAP_ARB);
	glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, normalisationCubeMap);
	
	glActiveTextureARB(GL_TEXTURE0_ARB);

	

	//Set up Register combiners
	//2 general combiners
	glCombinerParameteriNV(GL_NUM_GENERAL_COMBINERS_NV, 2);

	//combiner 0 does	tex0.rgb dot tex1.rgb -> spare0.rgb,
	glCombinerInputNV(	GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_A_NV, GL_TEXTURE0_ARB,
						GL_EXPAND_NORMAL_NV, GL_RGB);
	glCombinerInputNV(	GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_B_NV, GL_TEXTURE1_ARB,
						GL_EXPAND_NORMAL_NV, GL_RGB);
	
	glCombinerOutputNV(	GL_COMBINER0_NV, GL_RGB, GL_SPARE0_NV, GL_DISCARD_NV, GL_DISCARD_NV,
						GL_NONE, GL_NONE, GL_TRUE, GL_FALSE, GL_FALSE);


	//combiner 1 does	2*((spare0.rgb * spare0.rgb)-0.5) -> spare0.rgb
	//					spare0.b   * tex0.a		-> spare0.a
	glCombinerInputNV(	GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_A_NV, GL_SPARE0_NV,
						GL_UNSIGNED_IDENTITY_NV, GL_RGB);
	glCombinerInputNV(	GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_B_NV, GL_SPARE0_NV,
						GL_UNSIGNED_IDENTITY_NV, GL_RGB);
	
	glCombinerOutputNV(	GL_COMBINER1_NV, GL_RGB, GL_SPARE0_NV, GL_DISCARD_NV, GL_DISCARD_NV,
						GL_SCALE_BY_TWO_NV, GL_BIAS_BY_NEGATIVE_ONE_HALF_NV,
						GL_FALSE, GL_FALSE, GL_FALSE);


	glCombinerInputNV(	GL_COMBINER1_NV, GL_ALPHA, GL_VARIABLE_A_NV, GL_SPARE0_NV,
						GL_UNSIGNED_IDENTITY_NV, GL_BLUE);
	glCombinerInputNV(	GL_COMBINER1_NV, GL_ALPHA, GL_VARIABLE_B_NV, GL_TEXTURE0_ARB,
						GL_UNSIGNED_IDENTITY_NV, GL_ALPHA);
	
	glCombinerOutputNV(	GL_COMBINER1_NV, GL_ALPHA, GL_SPARE0_NV, GL_DISCARD_NV, GL_DISCARD_NV,
						GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE);



	//final combiner outputs spare0.rgb*spare0.rgb*spare0.a
	//first do spare0.rgb * spare0.rgb in EF multiplier
	glFinalCombinerInputNV(GL_VARIABLE_E_NV, GL_SPARE0_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
	glFinalCombinerInputNV(GL_VARIABLE_F_NV, GL_SPARE0_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
	
	glFinalCombinerInputNV(GL_VARIABLE_A_NV, GL_E_TIMES_F_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
	glFinalCombinerInputNV(GL_VARIABLE_B_NV, GL_SPARE0_NV, GL_UNSIGNED_IDENTITY_NV, GL_ALPHA);
	glFinalCombinerInputNV(GL_VARIABLE_C_NV, GL_ZERO, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
	glFinalCombinerInputNV(GL_VARIABLE_D_NV, GL_ZERO, GL_UNSIGNED_IDENTITY_NV, GL_RGB);

	glEnable(GL_REGISTER_COMBINERS_NV);
	
	
	//Set up vertex program
	glEnable(GL_VERTEX_PROGRAM_NV);
	glBindProgramNV(GL_VERTEX_PROGRAM_NV, simpleSpecularVertexProgram);
}
예제 #9
0
void SetSinglePassStates(void)
{
	//Bind textures
	//Unit 0 - normal map
	glEnable(GL_TEXTURE_2D);
	if(showBumps)
		glBindTexture(GL_TEXTURE_2D, normalMapTexture);
	else
		glBindTexture(GL_TEXTURE_2D, flatNormalMap);

	//Unit 1 - normalisation cube map
	glActiveTextureARB(GL_TEXTURE1_ARB);
	glEnable(GL_TEXTURE_CUBE_MAP_ARB);
	glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, normalisationCubeMap);
	
	//Unit 2 - normalisation cube map
	glActiveTextureARB(GL_TEXTURE2_ARB);
	glEnable(GL_TEXTURE_CUBE_MAP_ARB);
	glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, normalisationCubeMap);
	
	//Unit 3 - decal texture
	glActiveTextureARB(GL_TEXTURE3_ARB);
	glEnable(GL_TEXTURE_2D);
	glBindTexture(GL_TEXTURE_2D, decalTexture);

	glActiveTextureARB(GL_TEXTURE0_ARB);

	

	//Set up Register combiners
	//3 general combiners
	glCombinerParameteriNV(GL_NUM_GENERAL_COMBINERS_NV, 4);

	//combiner 0 does	tex0.rgb dot tex1.rgb -> spare0.rgb,
	//					tex0.rgb dot tex2.rgb -> spare1.rgb
	glCombinerInputNV(	GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_A_NV, GL_TEXTURE0_ARB,
						GL_EXPAND_NORMAL_NV, GL_RGB);
	glCombinerInputNV(	GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_B_NV, GL_TEXTURE1_ARB,
						GL_EXPAND_NORMAL_NV, GL_RGB);
	
	glCombinerInputNV(	GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_C_NV, GL_TEXTURE0_ARB,
						GL_EXPAND_NORMAL_NV, GL_RGB);
	glCombinerInputNV(	GL_COMBINER0_NV, GL_RGB, GL_VARIABLE_D_NV, GL_TEXTURE2_ARB,
						GL_EXPAND_NORMAL_NV, GL_RGB);
	
	glCombinerOutputNV(	GL_COMBINER0_NV, GL_RGB, GL_SPARE0_NV, GL_SPARE1_NV, GL_DISCARD_NV,
						GL_NONE, GL_NONE, GL_TRUE, GL_TRUE, GL_FALSE);


	//combiner 1 does	spare1.rgb * spare1.rgb -> spare1.rgb
	//					spare0.rgb * tex3.rgb   -> spare0.rgb
	glCombinerInputNV(	GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_A_NV, GL_SPARE1_NV,
						GL_UNSIGNED_IDENTITY_NV, GL_RGB);
	glCombinerInputNV(	GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_B_NV, GL_SPARE1_NV,
						GL_UNSIGNED_IDENTITY_NV, GL_RGB);
	glCombinerInputNV(	GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_C_NV, GL_SPARE0_NV,
						GL_UNSIGNED_IDENTITY_NV, GL_RGB);
	glCombinerInputNV(	GL_COMBINER1_NV, GL_RGB, GL_VARIABLE_D_NV, GL_TEXTURE3_ARB,
						GL_UNSIGNED_IDENTITY_NV, GL_RGB);
	
	glCombinerOutputNV(	GL_COMBINER1_NV, GL_RGB, GL_SPARE1_NV, GL_SPARE0_NV, GL_DISCARD_NV,
						GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE);


	//combiner 2 does	spare1.rgb * spare1.rgb -> spare1.rgb
	glCombinerInputNV(	GL_COMBINER2_NV, GL_RGB, GL_VARIABLE_A_NV, GL_SPARE1_NV,
						GL_UNSIGNED_IDENTITY_NV, GL_RGB);
	glCombinerInputNV(	GL_COMBINER2_NV, GL_RGB, GL_VARIABLE_B_NV, GL_SPARE1_NV,
						GL_UNSIGNED_IDENTITY_NV, GL_RGB);
	
	glCombinerOutputNV(	GL_COMBINER2_NV, GL_RGB, GL_SPARE1_NV, GL_DISCARD_NV, GL_DISCARD_NV,
						GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE);

	//combiner 3 does	spare1.rgb * spare1.rgb -> spare1.rgb
	glCombinerInputNV(	GL_COMBINER3_NV, GL_RGB, GL_VARIABLE_A_NV, GL_SPARE1_NV,
						GL_UNSIGNED_IDENTITY_NV, GL_RGB);
	glCombinerInputNV(	GL_COMBINER3_NV, GL_RGB, GL_VARIABLE_B_NV, GL_SPARE1_NV,
						GL_UNSIGNED_IDENTITY_NV, GL_RGB);
	
	glCombinerOutputNV(	GL_COMBINER3_NV, GL_RGB, GL_SPARE1_NV, GL_DISCARD_NV, GL_DISCARD_NV,
						GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE);

	//final combiner outputs spare1.rgb*spare1.rgb*tex0.a+spare0.rgb
	//First do spare1.rgb*spare1.rgb in EF multiplier
	glFinalCombinerInputNV(GL_VARIABLE_E_NV, GL_SPARE1_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
	glFinalCombinerInputNV(GL_VARIABLE_F_NV, GL_SPARE1_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
	
	//Now do rest
	glFinalCombinerInputNV(GL_VARIABLE_A_NV, GL_E_TIMES_F_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
	glFinalCombinerInputNV(GL_VARIABLE_B_NV, GL_TEXTURE0_ARB, GL_UNSIGNED_IDENTITY_NV, GL_ALPHA);
	glFinalCombinerInputNV(GL_VARIABLE_C_NV, GL_ZERO, GL_UNSIGNED_IDENTITY_NV, GL_RGB);
	glFinalCombinerInputNV(GL_VARIABLE_D_NV, GL_SPARE0_NV, GL_UNSIGNED_IDENTITY_NV, GL_RGB);

	glEnable(GL_REGISTER_COMBINERS_NV);
	
	
	//Set up vertex program
	glEnable(GL_VERTEX_PROGRAM_NV);
	glBindProgramNV(GL_VERTEX_PROGRAM_NV, singlePassVertexProgram);
}