PDA

View Full Version : Adding Chrome to a primmitive



DPalomo
03-12-2000, 10:15 PM
Hi All,

does anyone know how to add chrome/metalic look to a primitive? Some sourcecode would help a lot ;-)

Thanx,

Daniel

dmy
03-12-2000, 11:03 PM
a way to achieve this is to make a second rendering pass.

in the first, you draw your object.
in the second you blend the chroming.

your object must have normals (or something resembling)
try this:





glDepthFunc(GL_LEQUAL);

glDisable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);

<render object>

glEnable(GL_TEXTURE_2D);
glEnable(GL_BLEND);
glBlendFunc(GL_ONE,GL_ONE);
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glTexGeni(GL_S,GL_TEXTURE_GEN_MODE,GL_SPHERE_MAP);
glTexGeni(GL_T,GL_TEXTURE_GEN_MODE,GL_SPHERE_MAP);
glBindTexture(GL_TEXTURE_2D,texid_chrome);

<render object>



this should work.

Dolo/\/\ightY

DPalomo
03-13-2000, 12:48 AM
Thank you http://www.opengl.org/discussion_boards/ubb/biggrin.gif,

Daniel.