Front face & Back face

Started by
4 comments, last by Cityhunter 21 years, 8 months ago
Is there a way to draw the front face and back face of a object with different colors?
Advertisement
float red[] = { 1.0f, 0.0f, 0.0f, 1.0f };
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red);
float green[] = { 0.0f, 1.0f, 0.0f, 1.0f };
glMaterialfv(GL_BACK, GL_AMBIENT_AND_DIFFUSE, green);

Don''t know if that will work, only used glMaterial once before. Wouldn''t hurt to try.
If you can''t find any official functions for it, you could always render with back-face culling on, change colour, then render with front-face culling.

------------
MSN: nmaster42@hotmail.com, AIM: LockePick42, ICQ: 74128155
"It''s all part of the conspiracy of conspirators conspiring to conspire their own conspiracies..."
_______________________________________Pixelante Game Studios - Fowl Language
On like a cube yes, cilenders and spheres I dontr know.
I tried the front and back with GL_material, but I''m not doing gl_lighting. i''m writing my own lighting function. SO the glmaterial is really not working. Is there another way? Thanks
THe last time I read about front/back face lighting, all the info suggestd that only high end workstation cards support this in hardware. So if you do try it, it will likly bog you down very quickly. LockePick''s suggestion is more sound. Simply swap your culling order (glCullFace(GL_BACK) to glCullFace(GL_FRONT) and back again)..

<-- smile :-)
cityhunter:well, if you do lighting yourself simply turn of backface culling so both sides of faces are drawn and check face normal vector yourself to know if it''s facing camera or not. Then you just use one color or another. Simple.
With best regards, Mirek Czerwiñski

This topic is closed to new replies.

Advertisement