Vertex colors with texturing?

Started by
4 comments, last by DeathWish 22 years, 7 months ago
hey all, I''m sorta a noob at OpenGL, but here goes anyhow Is it possible to assign a color to a vertex and ALSO texture that face? (So you get the color blended with the texture.) If so, how do you go about it? Thanks, DeathWish
Advertisement
Yes.

------------------------------
Trent (ShiningKnight)
E-mail me
ShiningKnight Games
Umm... I can''t seem to get it working. I''m doing:

glEnable(GL_LIGHTING);
glBindTexture(GL_TEXTURE_2D, textures[0]);

glBegin(GL_TRIANGLES);
glNormal3f(xn, yn, zn);

// then for each vertex:
glColor3f(colr, colg, colb);
glTexCoord2f(u, v);
glVertex3f(x, y, z);

glEnd();

However, it simply maps the texture without blending in the colors set with glColor3f. Am I not enabling something I should?

Thanks,
DeathWish
You need to set the texture environment parameter to GL_MODULATE, its probably set as GL_DECAL by default - that overrides the base colour. Take a look at some of the texturing examples on my site...

Paul Groves
pauls opengl page
Paul Grovespauls opengl page
Ah, it works great now Thanks

By the way, that''s a nice informative site you''ve got there, I''ll be making some future visits.

Cheers,
Francis "DeathWish" Woodhouse
disable the lighting. if u want to use the lighting + colors use materials (check the red book or the spec for further info)

This topic is closed to new replies.

Advertisement