• Advertisement

Archived

This topic is now archived and is closed to further replies.

Vertex colors with texturing?

This topic is 5990 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
disable the lighting. if u want to use the lighting + colors use materials (check the red book or the spec for further info)

Share this post


Link to post
Share on other sites

  • Advertisement