Sign in to follow this  
riruilo

Question about Ne He toturial Lesson 26

Recommended Posts

riruilo    218
Hi friends, I like this tutorial and it do what I want. It is a ball with 2 textures, a difuese texture and a reflective texture, the last one is blended in 40% with the first one. But this code uses 2 passes and my question is how can I do it with multitexturing (1 pass), specially mixing with a arbitrary amount of reflective texture. What stages of multitexturing shuold I use? Thanks a lot.
void DrawObject() n// Draw Our Ball
{
	glColor3f(1.0f, 1.0f, 1.0f);	// Set Color To White
	glBindTexture(GL_TEXTURE_2D, texture[1]); // Select Texture 2 (1)
	gluSphere(q, 0.35f, 32, 16);// Draw First Sphere

	glBindTexture(GL_TEXTURE_2D, texture[2]);// Select Texture 3 (2)
	glColor4f(1.0f, 1.0f, 1.0f, 0.4f);// Set Color To White With 40% Alpha
	glEnable(GL_BLEND);// Enable Blending
	glBlendFunc(GL_SRC_ALPHA, GL_ONE);// Set Blending Mode To Mix Based On SRC Alpha
	glEnable(GL_TEXTURE_GEN_S);// Enable Sphere Mapping
	glEnable(GL_TEXTURE_GEN_T);// Enable Sphere Mapping

	gluSphere(q, 0.35f, 32, 16);// Draw Another Sphere Using New Texture
// Textures Will Mix Creating A MultiTexture Effect (Reflection)
	glDisable(GL_TEXTURE_GEN_S);	// Disable Sphere Mapping
	glDisable(GL_TEXTURE_GEN_T);	// Disable Sphere Mapping
	glDisable(GL_BLEND);		// Disable Blending
}

Share this post


Link to post
Share on other sites
riruilo    218
By the way, I realize that maybe there is a bug.

If I change the alpha value in this line:
glColor4f(1.0f, 1.0f, 1.0f, 0.4f);// Set Color To White With 40% Alpha

to 0.1 or 0.9, the ball is exactly the same.

Do you have any idea?

Thanks!

Share this post


Link to post
Share on other sites
riruilo    218
Does anyone why if I change that value it doesnt worlk properly?

or do you know the email of the authors to ask them?

Banu Octavian (Choko)
Jeff Molofee (NeHe)

See you! Thanks.

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