   how to shade triangles and make transparent
  ok so if you have read one of my recent posts then you know im trying to make a few shapes like an icosahedron. well now i have got that part down pretty well i just want to be able to make them transparent and have shading but i dont know how to do this. here's my code#include <windows.h>#include <GL/glut.h>#include <GL/gl.h>#include <GL/glu.h>#include <stdlib.h>#include <stdio.h>#include <cmath>const GLfloat G_RATIO = (1 - sqrt(5))/2;GLfloatrtri;const GLfloat P1[] =   {0.0f, 1.0f, G_RATIO};const GLfloat P2[] ={0.0f,-1.0f, G_RATIO};const GLfloat P3[] ={ 0.0f,-1.0f, -G_RATIO};const GLfloat P4[] ={0.0f, 1.0f, -G_RATIO};const GLfloat P5[] ={1.0f,G_RATIO, 0.0f};const GLfloat P6[] ={ -1.0f,G_RATIO, 0.0f};const GLfloat P7[] ={ -1.0f, -G_RATIO, 0.0f};const GLfloat P8[] ={1.0f,-G_RATIO, 0.0f};const GLfloat P9[] ={ G_RATIO,0.0f, 1.0f};const GLfloat P10[] ={ -G_RATIO, 0.0f, 1.0f};const GLfloat P11[] ={-G_RATIO,0.0f, - 1.0f};const GLfloat P12[] ={ G_RATIO,0.0f, -1.0f};char *one;char *two;char *three;char *four;char *five;char *six;char *seven;char *eight;char *nine;char *ten;char *eleven;char *twelve;static void resize(int width, int height){    const float ar = (float) width / (float) height;    glDisable(GL_CULL_FACE);    glEnable(GL_BLEND);    glViewport(0, 0, width, height);    glMatrixMode(GL_PROJECTION);    glLoadIdentity();    glFrustum(-ar, ar, -1.0, 1.0, 2.0, 100.0);    glMatrixMode(GL_MODELVIEW);    glLoadIdentity() ;}static void display(void){    const double t = glutGet(GLUT_ELAPSED_TIME) / 1000.0;    const double a = t*90.0;    one = "1";    two = "2";    three = "3";    four = "4";    five = "5";    six = "6";    seven = "7";    eight = "8";    nine = "9";    ten = "t";    eleven = "e";    twelve = "w";    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);    glLoadIdentity();glTranslatef(0.0f,0.0f,-5.0f);    glRotatef(rtri,0.0f,1.0f,0.0f);    glBegin(GL_TRIANGLES);glRasterPos3fv(P1);   glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, *one);glColor3f(1.0f,0.0f,0.0f);// Set Top Point Of Triangle To RedglVertex3fv( P1);// First Point Of The TriangleglColor3f(0.0f,1.0f,0.0f);// Set Left Point Of Triangle To GreenglVertex3fv(P4);// Second Point Of The TriangleglColor3f(0.0f,0.0f,1.0f);// Set Right Point Of Triangle To BlueglVertex3fv( P7);   glColor3f(1.0f,0.0f,0.0f);// Set Top Point Of Triangle To RedglVertex3fv( P1);// First Point Of The TriangleglColor3f(0.0f,1.0f,0.0f);// Set Left Point Of Triangle To GreenglVertex3fv(P4);// Second Point Of The TriangleglColor3f(0.0f,0.0f,1.0f);// Set Right Point Of Triangle To BlueglVertex3fv( P8);   glColor3f(1.0f,0.0f,0.0f);// Set Top Point Of Triangle To RedglVertex3fv( P1);// First Point Of The TriangleglColor3f(0.0f,1.0f,0.0f);// Set Left Point Of Triangle To GreenglVertex3fv(P11);// Second Point Of The TriangleglColor3f(0.0f,0.0f,1.0f);// Set Right Point Of Triangle To BlueglVertex3fv( P12);   glColor3f(1.0f,0.0f,0.0f);// Set Top Point Of Triangle To RedglVertex3fv( P4);// First Point Of The TriangleglColor3f(0.0f,1.0f,0.0f);// Set Left Point Of Triangle To GreenglVertex3fv(P9);// Second Point Of The TriangleglColor3f(0.0f,0.0f,1.0f);// Set Right Point Of Triangle To BlueglVertex3fv( P10);   glColor3f(1.0f,0.0f,0.0f);// Set Top Point Of Triangle To RedglVertex3fv( P4);// First Point Of The TriangleglColor3f(0.0f,1.0f,0.0f);// Set Left Point Of Triangle To GreenglVertex3fv(P9);// Second Point Of The TriangleglColor3f(0.0f,0.0f,1.0f);// Set Right Point Of Triangle To BlueglVertex3fv( P7);   glColor3f(1.0f,0.0f,0.0f);// Set Top Point Of Triangle To RedglVertex3fv( P1);// First Point Of The TriangleglColor3f(0.0f,1.0f,0.0f);// Set Left Point Of Triangle To GreenglVertex3fv(P11);// Second Point Of The TriangleglColor3f(0.0f,0.0f,1.0f);// Set Right Point Of Triangle To BlueglVertex3fv( P8);   glColor3f(1.0f,0.0f,0.0f);// Set Top Point Of Triangle To RedglVertex3fv( P1);// First Point Of The TriangleglColor3f(0.0f,1.0f,0.0f);// Set Left Point Of Triangle To GreenglVertex3fv(P12);// Second Point Of The TriangleglColor3f(0.0f,0.0f,1.0f);// Set Right Point Of Triangle To BlueglVertex3fv( P7);   glColor3f(1.0f,0.0f,0.0f);// Set Top Point Of Triangle To RedglVertex3fv( P4);// First Point Of The TriangleglColor3f(0.0f,1.0f,0.0f);// Set Left Point Of Triangle To GreenglVertex3fv(P10);// Second Point Of The TriangleglColor3f(0.0f,0.0f,1.0f);// Set Right Point Of Triangle To BlueglVertex3fv( P8);   glColor3f(1.0f,0.0f,0.0f);// Set Top Point Of Triangle To RedglVertex3fv( P8);// First Point Of The TriangleglColor3f(0.0f,1.0f,0.0f);// Set Left Point Of Triangle To GreenglVertex3fv(P5);// Second Point Of The TriangleglColor3f(0.0f,0.0f,1.0f);// Set Right Point Of Triangle To BlueglVertex3fv( P10);   glColor3f(1.0f,0.0f,0.0f);// Set Top Point Of Triangle To RedglVertex3fv( P8);// First Point Of The TriangleglColor3f(0.0f,1.0f,0.0f);// Set Left Point Of Triangle To GreenglVertex3fv(P11);// Second Point Of The TriangleglColor3f(0.0f,0.0f,1.0f);// Set Right Point Of Triangle To BlueglVertex3fv( P5);   glColor3f(1.0f,0.0f,0.0f);// Set Top Point Of Triangle To RedglVertex3fv( P7);// First Point Of The TriangleglColor3f(0.0f,1.0f,0.0f);// Set Left Point Of Triangle To GreenglVertex3fv(P12);// Second Point Of The TriangleglColor3f(0.0f,0.0f,1.0f);// Set Right Point Of Triangle To BlueglVertex3fv( P6);   glColor3f(1.0f,0.0f,0.0f);// Set Top Point Of Triangle To RedglVertex3fv( P7);// First Point Of The TriangleglColor3f(0.0f,1.0f,0.0f);// Set Left Point Of Triangle To GreenglVertex3fv(P9);// Second Point Of The TriangleglColor3f(0.0f,0.0f,1.0f);// Set Right Point Of Triangle To BlueglVertex3fv( P6);   glColor3f(1.0f,0.0f,0.0f);// Set Top Point Of Triangle To RedglVertex3fv( P12);// First Point Of The TriangleglColor3f(0.0f,1.0f,0.0f);// Set Left Point Of Triangle To GreenglVertex3fv(P11);// Second Point Of The TriangleglColor3f(0.0f,0.0f,1.0f);// Set Right Point Of Triangle To BlueglVertex3fv( P2);   glColor3f(1.0f,0.0f,0.0f);// Set Top Point Of Triangle To RedglVertex3fv( P12);// First Point Of The TriangleglColor3f(0.0f,1.0f,0.0f);// Set Left Point Of Triangle To GreenglVertex3fv(P2);// Second Point Of The TriangleglColor3f(0.0f,0.0f,1.0f);// Set Right Point Of Triangle To BlueglVertex3fv( P6);   glColor3f(1.0f,0.0f,0.0f);// Set Top Point Of Triangle To RedglVertex3fv( P9);// First Point Of The TriangleglColor3f(0.0f,1.0f,0.0f);// Set Left Point Of Triangle To GreenglVertex3fv(P10);// Second Point Of The TriangleglColor3f(0.0f,0.0f,1.0f);// Set Right Point Of Triangle To BlueglVertex3fv( P3);   glColor3f(1.0f,0.0f,0.0f);// Set Top Point Of Triangle To RedglVertex3fv( P11);// First Point Of The TriangleglColor3f(0.0f,1.0f,0.0f);// Set Left Point Of Triangle To GreenglVertex3fv(P5);// Second Point Of The TriangleglColor3f(0.0f,0.0f,1.0f);// Set Right Point Of Triangle To BlueglVertex3fv( P2);   glColor3f(1.0f,0.0f,0.0f);// Set Top Point Of Triangle To RedglVertex3fv( P5);// First Point Of The TriangleglColor3f(0.0f,1.0f,0.0f);// Set Left Point Of Triangle To GreenglVertex3fv(P10);// Second Point Of The TriangleglColor3f(0.0f,0.0f,1.0f);// Set Right Point Of Triangle To BlueglVertex3fv( P3);   glColor3f(1.0f,0.0f,0.0f);// Set Top Point Of Triangle To RedglVertex3fv( P5);// First Point Of The TriangleglColor3f(0.0f,1.0f,0.0f);// Set Left Point Of Triangle To GreenglVertex3fv(P2);// Second Point Of The TriangleglColor3f(0.0f,0.0f,1.0f);// Set Right Point Of Triangle To BlueglVertex3fv( P3);   glColor3f(1.0f,0.0f,0.0f);// Set Top Point Of Triangle To RedglVertex3fv( P9);// First Point Of The TriangleglColor3f(0.0f,1.0f,0.0f);// Set Left Point Of Triangle To GreenglVertex3fv(P6);// Second Point Of The TriangleglColor3f(0.0f,0.0f,1.0f);// Set Right Point Of Triangle To BlueglVertex3fv( P3);glEnd();glRasterPos3fv(P1);    glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, *one);    glRasterPos3fv(P2);    glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, *two);    glRasterPos3fv(P3);    glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, *three);    glRasterPos3fv(P4);    glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, *four);    glRasterPos3fv(P5);    glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, *five);    glRasterPos3fv(P6);    glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, *six);    glRasterPos3fv(P7);    glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, *seven);    glRasterPos3fv(P8);    glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, *eight);    glRasterPos3fv(P9);    glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, *nine);    glRasterPos3fv(P10);    glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, *ten);    glRasterPos3fv(P11);    glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, *eleven);    glRasterPos3fv(P12);    glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, *twelve);rtri+=1.0f;    glutSwapBuffers();}void renderBitmapString(float x,float y,float z,void *font,char *string) {  char *c;  glRasterPos3f(x, y,z);  for (c=string; *c != '\0'; c++) {    glutBitmapCharacter(font, *c);  }}static void key(unsigned char key, int x, int y){    switch (key)    {    }    glutPostRedisplay();}static void idle(void){    glutPostRedisplay();}const GLfloat light_ambient[]  = { 0.0f, 0.0f, 0.0f, 1.0f };const GLfloat light_diffuse[]  = { 1.0f, 1.0f, 1.0f, 1.0f };const GLfloat light_specular[] = { 1.0f, 1.0f, 1.0f, 1.0f };const GLfloat light_position[] = { 2.0f, 5.0f, 5.0f, 0.0f };const GLfloat mat_ambient[]    = { 0.7f, 0.7f, 0.7f, 1.0f };const GLfloat mat_diffuse[]    = { 0.8f, 0.8f, 0.8f, 1.0f };const GLfloat mat_specular[]   = { 1.0f, 1.0f, 1.0f, 1.0f };const GLfloat high_shininess[] = { 100.0f };/* Program entry point */int main(int argc, char *argv[]){    glutInit(&argc, argv);    glutInitWindowSize(640,480);    glutInitWindowPosition(10,10);    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);    glutCreateWindow("GLUT Shapes");    glutReshapeFunc(resize);    glutDisplayFunc(display);    glutKeyboardFunc(key);    glutIdleFunc(idle);    glClearColor(1,1,1,1);    glEnable(GL_CULL_FACE);    glCullFace(GL_BACK);    glEnable(GL_DEPTH_TEST);    glDepthFunc(GL_LESS);    glEnable(GL_LIGHT0);    glEnable(GL_NORMALIZE);    glEnable(GL_COLOR_MATERIAL);    glEnable(GL_LIGHTING);    glLightfv(GL_LIGHT0, GL_AMBIENT,  light_ambient);    glLightfv(GL_LIGHT0, GL_DIFFUSE,  light_diffuse);    glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular);    glLightfv(GL_LIGHT0, GL_POSITION, light_position);    glMaterialfv(GL_FRONT, GL_AMBIENT,   mat_ambient);    glMaterialfv(GL_FRONT, GL_DIFFUSE,   mat_diffuse);    glMaterialfv(GL_FRONT, GL_SPECULAR,  mat_specular);    glMaterialfv(GL_FRONT, GL_SHININESS, high_shininess);    glutMainLoop();    return 1;}
  Do a search for alpha blending. Its fairly easy, once you setup the blend func (1 line, can't recall right now but its soemthign like glBlendFunc(gl_src_alpha, gl_one_minus_src_alpha)) you just need to give your triangles an alpha value, you can do that when you set their colorglColor(r,g,b, alpha).It gets slightly more complicated in that you might need to sort triangles manually by distance from the camera or they won't render correctly (some may appear infront when they should be ebhind etc).   ;  thanks for the glblendfunc() it works grate!!!! but i still want distinct shading or lighting to give the shape a more realistic feel. here is my current code. #include <windows.h>#include <GL/glut.h>#include <GL/gl.h>#include <GL/glu.h>#include <stdlib.h>#include <stdio.h>#include <cmath>const GLfloat G_RATIO = (1 - sqrt(5))/2;GLfloatrtri;const GLfloat P1[] =   {0.0f, 1.0f, G_RATIO};const GLfloat P2[] ={0.0f,-1.0f, G_RATIO};const GLfloat P3[] ={ 0.0f,-1.0f, -G_RATIO};const GLfloat P4[] ={0.0f, 1.0f, -G_RATIO};const GLfloat P5[] ={1.0f,G_RATIO, 0.0f};const GLfloat P6[] ={ -1.0f,G_RATIO, 0.0f};const GLfloat P7[] ={ -1.0f, -G_RATIO, 0.0f};const GLfloat P8[] ={1.0f,-G_RATIO, 0.0f};const GLfloat P9[] ={ G_RATIO,0.0f, 1.0f};const GLfloat P10[] ={ -G_RATIO, 0.0f, 1.0f};const GLfloat P11[] ={-G_RATIO,0.0f, - 1.0f};const GLfloat P12[] ={ G_RATIO,0.0f, -1.0f};const GLfloat purple[] ={ 1.0f,0.0f,1.0f,0.4f};const GLfloat green[] ={ 0.0f,1.0f,0.0f,0.4f};const GLfloat blue[] ={ 0.0f,0.0f,1.0f,0.4f};char *one;char *two;char *three;char *four;char *five;char *six;char *seven;char *eight;char *nine;char *ten;char *eleven;char *twelve;const GLfloat light_ambient[]  = { 0.0f, 0.0f, 0.0f, 1.0f };const GLfloat light_diffuse[]  = { 1.0f, 1.0f, 1.0f, 1.0f };const GLfloat light_specular[] = { 1.0f, 1.0f, 1.0f, 1.0f };const GLfloat light_position[] = { 2.0f, 5.0f, 5.0f, 0.0f };const GLfloat mat_ambient[]    = { 0.7f, 0.7f, 0.7f, 1.0f };const GLfloat mat_diffuse[]    = { 0.8f, 0.8f, 0.8f, 1.0f };const GLfloat mat_specular[]   = { 1.0f, 1.0f, 1.0f, 1.0f };const GLfloat high_shininess[] = { 100.0f };static void resize(int width, int height){    const float ar = (float) width / (float) height;    glDisable(GL_CULL_FACE);    glEnable(GL_BLEND);    glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);    glViewport(0, 0, width, height);    glShadeModel(GL_SMOOTH);    glEnable(GL_LIGHT1);    glLightfv(GL_LIGHT1, GL_AMBIENT, light_ambient);    glLightfv(GL_LIGHT1, GL_DIFFUSE, light_diffuse);    glLightfv(GL_LIGHT1, GL_SPECULAR, light_specular);    glLightfv(GL_LIGHT1, GL_POSITION, light_position);    glMatrixMode(GL_PROJECTION);    glFrustum(-ar, ar, -1.0, 1.0, 2.0, 100.0);    glMatrixMode(GL_MODELVIEW);    glLoadIdentity() ;}static void display(void){    const double t = glutGet(GLUT_ELAPSED_TIME) / 1000.0;    const double a = t*90.0;    one = "1";    two = "2";    three = "3";    four = "4";    five = "5";    six = "6";    seven = "7";    eight = "8";    nine = "9";    ten = "t";    eleven = "e";    twelve = "w";   glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);    glLoadIdentity();glTranslatef(0.0f,0.0f,-5.0f);    glRotatef(rtri,0.0f,1.0f,0.0f);    glBegin(GL_TRIANGLES);glColor4fv(blue);// Set Top Point Of Triangle To RedglVertex3fv( P1);// First Point Of The TriangleglColor4fv(green);// Set Left Point Of Triangle To GreenglVertex3fv(P4);// Second Point Of The TriangleglColor4fv(purple);// Set Right Point Of Triangle To BlueglVertex3fv( P7);   glColor4fv(blue);// Set Top Point Of Triangle To RedglVertex3fv( P1);// First Point Of The TriangleglColor4fv(green);// Set Left Point Of Triangle To GreenglVertex3fv(P4);// Second Point Of The Triangle    glColor4fv(purple);// Set Right Point Of Triangle To BlueglVertex3fv( P8);   glColor4fv(blue);// Set Top Point Of Triangle To RedglVertex3fv( P1);// First Point Of The TriangleglColor4fv(green);// Set Left Point Of Triangle To GreenglVertex3fv(P11);// Second Point Of The TriangleglColor4fv(purple);// Set Right Point Of Triangle To BlueglVertex3fv( P12);   glColor4fv(blue);// Set Top Point Of Triangle To RedglVertex3fv( P4);// First Point Of The Triangle    glColor4fv(green);// Set Left Point Of Triangle To GreenglVertex3fv(P9);// Second Point Of The Triangle    glColor4fv(purple);// Set Right Point Of Triangle To BlueglVertex3fv( P10);   glColor4fv(blue);// Set Top Point Of Triangle To RedglVertex3fv( P4);// First Point Of The TriangleglColor4fv(green);// Set Left Point Of Triangle To GreenglVertex3fv(P9);// Second Point Of The Triangle    glColor4fv(purple);// Set Right Point Of Triangle To BlueglVertex3fv( P7);   glColor4fv(blue);// Set Top Point Of Triangle To RedglVertex3fv( P1);// First Point Of The TriangleglColor4fv(green);// Set Left Point Of Triangle To GreenglVertex3fv(P11);// Second Point Of The TriangleglColor4fv(purple);// Set Right Point Of Triangle To BlueglVertex3fv( P8);   glColor4fv(blue);// Set Top Point Of Triangle To RedglVertex3fv( P1);// First Point Of The TriangleglColor4fv(green);// Set Left Point Of Triangle To GreenglVertex3fv(P12);// Second Point Of The TriangleglColor4fv(purple);// Set Right Point Of Triangle To BlueglVertex3fv( P7);   glColor4fv(blue);// Set Top Point Of Triangle To RedglVertex3fv( P4);// First Point Of The TriangleglColor4fv(green);// Set Left Point Of Triangle To GreenglVertex3fv(P10);// Second Point Of The TriangleglColor4fv(purple);// Set Right Point Of Triangle To BlueglVertex3fv( P8);   glColor4fv(blue);// Set Top Point Of Triangle To RedglVertex3fv( P8);// First Point Of The TriangleglColor4fv(green);// Set Left Point Of Triangle To GreenglVertex3fv(P5);// Second Point Of The TriangleglColor4fv(purple);// Set Right Point Of Triangle To BlueglVertex3fv( P10);   glColor4fv(blue);// Set Top Point Of Triangle To RedglVertex3fv( P8);// First Point Of The TriangleglColor4fv(green);// Set Left Point Of Triangle To GreenglVertex3fv(P11);// Second Point Of The TriangleglColor4fv(purple);// Set Right Point Of Triangle To BlueglVertex3fv( P5);   glColor4fv(blue);// Set Top Point Of Triangle To RedglVertex3fv( P7);// First Point Of The TriangleglColor4fv(green);// Set Left Point Of Triangle To GreenglVertex3fv(P12);// Second Point Of The TriangleglColor4fv(purple);// Set Right Point Of Triangle To BlueglVertex3fv( P6);   glColor4fv(blue);// Set Top Point Of Triangle To RedglVertex3fv( P7);// First Point Of The TriangleglColor4fv(green);// Set Left Point Of Triangle To GreenglVertex3fv(P9);// Second Point Of The TriangleglColor4fv(purple);// Set Right Point Of Triangle To BlueglVertex3fv( P6);   glColor4fv(blue);// Set Top Point Of Triangle To RedglVertex3fv( P12);// First Point Of The TriangleglColor4fv(green);// Set Left Point Of Triangle To GreenglVertex3fv(P11);// Second Point Of The TriangleglColor4fv(purple);// Set Right Point Of Triangle To BlueglVertex3fv( P2);   glColor4fv(blue);// Set Top Point Of Triangle To RedglVertex3fv( P12);// First Point Of The TriangleglColor4fv(green);// Set Left Point Of Triangle To GreenglVertex3fv(P2);// Second Point Of The TriangleglColor4fv(purple);// Set Right Point Of Triangle To BlueglVertex3fv( P6);   glColor4fv(blue);// Set Top Point Of Triangle To RedglVertex3fv( P9);// First Point Of The TriangleglColor4fv(green);// Set Left Point Of Triangle To GreenglVertex3fv(P10);// Second Point Of The TriangleglColor4fv(purple);// Set Right Point Of Triangle To BlueglVertex3fv( P3);   glColor4fv(blue);// Set Top Point Of Triangle To RedglVertex3fv( P11);// First Point Of The TriangleglColor4fv(green);// Set Left Point Of Triangle To GreenglVertex3fv(P5);// Second Point Of The TriangleglColor4fv(purple);// Set Right Point Of Triangle To BlueglVertex3fv( P2);   glColor4fv(blue);// Set Top Point Of Triangle To RedglVertex3fv( P5);// First Point Of The TriangleglColor4fv(green);// Set Left Point Of Triangle To GreenglVertex3fv(P10);// Second Point Of The TriangleglColor4fv(purple);// Set Right Point Of Triangle To BlueglVertex3fv( P3);   glColor4fv(blue);// Set Top Point Of Triangle To RedglVertex3fv( P5);// First Point Of The TriangleglColor4fv(green);// Set Left Point Of Triangle To GreenglVertex3fv(P2);// Second Point Of The TriangleglColor4fv(purple);// Set Right Point Of Triangle To BlueglVertex3fv( P3);   glColor4fv(blue);// Set Top Point Of Triangle To RedglVertex3fv( P9);// First Point Of The TriangleglColor4fv(green);// Set Left Point Of Triangle To GreenglVertex3fv(P6);// Second Point Of The TriangleglColor4fv(purple);// Set Right Point Of Triangle To BlueglVertex3fv( P3);glEnd();glColor4f(0.0f,1.0f,0.0f,1.0f);glRasterPos3fv(P1);    glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, *one);    glRasterPos3fv(P2);    glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, *two);    glRasterPos3fv(P3);    glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, *three);    glRasterPos3fv(P4);    glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, *four);    glRasterPos3fv(P5);    glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, *five);    glRasterPos3fv(P6);    glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, *six);    glRasterPos3fv(P7);    glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, *seven);    glRasterPos3fv(P8);    glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, *eight);    glRasterPos3fv(P9);    glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, *nine);    glRasterPos3fv(P10);    glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, *ten);    glRasterPos3fv(P11);    glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, *eleven);    glRasterPos3fv(P12);    glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, *twelve);rtri+=1.0f;    glutSwapBuffers();}void renderBitmapString(float x,float y,float z,void *font,char *string) {  char *c;  glRasterPos3f(x, y,z);  for (c=string; *c != '\0'; c++) {    glutBitmapCharacter(font, *c);  }}static void key(unsigned char key, int x, int y){    switch (key)    {    }    glutPostRedisplay();}static void idle(void){    glutPostRedisplay();}int main(int argc, char *argv[]){    glutInit(&argc, argv);    glutInitWindowSize(640,480);    glutInitWindowPosition(10,10);    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);    glutCreateWindow("GLUT Shapes");    glutReshapeFunc(resize);    glutDisplayFunc(display);    glutKeyboardFunc(key);    glutIdleFunc(idle);    glutMainLoop();    return 1;};  I'm not sure what it is exactly that you want but for lighting you need normals for your vertices. In order to get hard edges between the triangles you'd either have to duplicate your vertices (since only one normal per vertex is possible) or use flat shading glShadeModel(GL_FLAT). Note that flat shading would mean that each triangle gets only one color (i.e. you can have gradients).;  As Lord Evil said, your just missing normals. I see you've already setup a light so that should be fine. Where you have:glColor3f();glVertex3fv();Add glNormal3fv() just before glVertex3fv(), if you want the faces to be flat then you only need to specify the normal once for each face. Of course you still have to calculate your normals but thats relativly simple. glNormal:http://www.khronos.org/opengles/documentation/opengles1_0/html/glNormal.html   ;  Nanoha is right. You just need to call glNormal once per triangle for flat shading. If you're planning to use indexed VBOs or vertex arrays later on, you need to duplicate your vertices.   ;  ok grate, is there a function in OpenGL i can call on that will return the value of the Normal of a face EXAPLE: void GetNormalFace(GLfloat p1[], GLfloat p2[], GLfloat p3[])   ;  or in other words a function for OpenGL that returns the Normal of Three GLfloat arrays. might be something like glGetNormalfv(P1,P2,P3) so that that could be called on like glNormalfv(glGetNormalfv(P1,P2,P3))   ;Quote:Original post by ishkabibleok grate, is there a function in OpenGL i can call on that will return the value of the Normal of a face EXAPLE: void GetNormalFace(GLfloat p1[], GLfloat p2[], GLfloat p3[])There isn't but you can do it like this:GetNormalFace(Vector3 p1, Vector3 p2, Vector3 p3){ Vector3 side1 = p2 - p1; Vector3 side2 = p3 - p1; Vector3 normal = crossProduct(side1, side2); normal.Normalize();  return normal;}Google up the cross product and you're all set.Normalize does this:void Normalize(){   float magnitude = sqrtf(x*x + y*y + z*z);   x /= magnitude;   y /= magnitude;   z /= magnitude;}Good luck!   ;  ok i think i only need one last thing if i'm right. am i to understand that since the unit vector is always equal to 1 of what ever unit your in it doesn't matter in this case (i just don't understand why they would talk about something that did not matter, i am assuming i'm wrong and this wont be the last thing) here is the link to site i foundhttp://mathworld.wolfram.com/CrossProduct.html   