   how to make triangles visible from both sides
  OK so i'm making an icosahedron in this (well i have two triangles right now that don't really make a icosahedron) and i want to know how to make them visible on both sides. also if anyone has some insight on defining the correct triangles please say so.   
  glDisable(GL_CULL_FACE);this should be enough to figure out the coordinates;  thanks a million!!!!!o and i have already looked at that Wikipedia page but i cant seem to get the correct triangles even though i think i have the correct vertices (here's my code P1-P12 are vertices) #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.0f - sqrt(5.0f))/2.0f;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};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;    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);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(P1);// Second Point Of The TriangleglColor3f(0.0f,0.0f,1.0f);// Set Right Point Of Triangle To BlueglVertex3fv( P4);   glColor3f(1.0f,0.0f,0.0f);// Set Top Point Of Triangle To RedglVertex3fv( P6);// First Point Of The TriangleglColor3f(0.0f,1.0f,0.0f);// Set Left Point Of Triangle To GreenglVertex3fv(P1);// Second Point Of The TriangleglColor3f(0.0f,0.0f,1.0f);// Set Right Point Of Triangle To BlueglVertex3fv( P12);glEnd();rtri+=1.0f;    glutSwapBuffers();}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;};  o and i would also like to know how to make it transparent with out using textures.   ;  You are drawing 2 triangles...anyway, I don't have time to look into it. Get a piece of paper and a pen, and start sketching...   ;Quote:Original post by ishkabibleo and i would also like to know how to make it transparent with out using textures.glEnable(GL_BLEND) +  glColor4f(r,g,b, alpha) where alpha = 1 means opaque and alpha = 0 means fully transparent.Example:...glColor4f(1.0f,0.0f,0.0f, 0.5f); // P5 will be red with 50% transparency.glVertex3fv( P5);...You can change the blend equation with glBlendEquation and its factors with glBlendfunc but the default equation should be sufficient.Edit: Note that in order to get correct results for alpha blended primitives you need to render them back to front, use additive blending (GL_ONE for both factors in glBlendFunc) which results in a brightening (might not be what you want) or use more advanced techniques like alpha-to-coverage (uses a texture) or depth peeling (uses render-to-texture).   ;  *nevermind i got it working, took some stuff that didn't need to be in my main and (here's a duzy) changed the colors so there wansn't just one color to display.ok so i have this but it's just all one solid color not transparent at all so what did i do worng.#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;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);    glViewport(0, 0, width, height);    glShadeModel(GL_SMOOTH);    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);    glEnable(GL_LIGHT1);    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);glColor4f(1.0f,0.0f,0.0f,0.5f);// Set Top Point Of Triangle To RedglVertex3fv( P1);// First Point Of The TriangleglColor4f(1.0f,0.0f,0.0f,0.5f);// Set Left Point Of Triangle To GreenglVertex3fv(P4);// Second Point Of The TriangleglColor4f(1.0f,0.0f,0.0f,0.5f);// Set Right Point Of Triangle To BlueglVertex3fv( P7);   glColor4f(1.0f,0.0f,0.0f,0.5f);// Set Top Point Of Triangle To RedglVertex3fv( P1);// First Point Of The TriangleglColor4f(1.0f,0.0f,0.0f,0.5f);// Set Left Point Of Triangle To GreenglVertex3fv(P4);// Second Point Of The TriangleglColor4f(1.0f,0.0f,0.0f,0.5f);// Set Right Point Of Triangle To BlueglVertex3fv( P8);   glColor4f(1.0f,0.0f,0.0f,0.5f);// Set Top Point Of Triangle To RedglVertex3fv( P1);// First Point Of The TriangleglColor4f(1.0f,0.0f,0.0f,0.5f);// Set Left Point Of Triangle To GreenglVertex3fv(P11);// Second Point Of The TriangleglColor4f(1.0f,0.0f,0.0f,0.5f);// Set Right Point Of Triangle To BlueglVertex3fv( P12);   glColor4f(1.0f,0.0f,0.0f,0.5f);// Set Top Point Of Triangle To RedglVertex3fv( P4);// First Point Of The TriangleglColor4f(1.0f,0.0f,0.0f,0.5f);// Set Left Point Of Triangle To GreenglVertex3fv(P9);// Second Point Of The TriangleglColor4f(1.0f,0.0f,0.0f,0.5f);// Set Right Point Of Triangle To BlueglVertex3fv( P10);   glColor4f(1.0f,0.0f,0.0f,0.5f);// Set Top Point Of Triangle To RedglVertex3fv( P4);// First Point Of The TriangleglColor4f(1.0f,0.0f,0.0f,0.5f);// Set Left Point Of Triangle To GreenglVertex3fv(P9);// Second Point Of The TriangleglColor4f(1.0f,0.0f,0.0f,0.5f);// Set Right Point Of Triangle To BlueglVertex3fv( P7);   glColor4f(1.0f,0.0f,0.0f,0.5f);// Set Top Point Of Triangle To RedglVertex3fv( P1);// First Point Of The TriangleglColor4f(1.0f,0.0f,0.0f,0.5f);// Set Left Point Of Triangle To GreenglVertex3fv(P11);// Second Point Of The TriangleglColor4f(1.0f,0.0f,0.0f,0.5f);// Set Right Point Of Triangle To BlueglVertex3fv( P8);   glColor4f(1.0f,0.0f,0.0f,0.5f);// Set Top Point Of Triangle To RedglVertex3fv( P1);// First Point Of The TriangleglColor4f(1.0f,0.0f,0.0f,0.5f);// Set Left Point Of Triangle To GreenglVertex3fv(P12);// Second Point Of The TriangleglColor4f(1.0f,0.0f,0.0f,0.5f);// Set Right Point Of Triangle To BlueglVertex3fv( P7);   glColor4f(1.0f,0.0f,0.0f,0.5f);// Set Top Point Of Triangle To RedglVertex3fv( P4);// First Point Of The TriangleglColor4f(1.0f,0.0f,0.0f,0.5f);// Set Left Point Of Triangle To GreenglVertex3fv(P10);// Second Point Of The TriangleglColor4f(1.0f,0.0f,0.0f,0.5f);// Set Right Point Of Triangle To BlueglVertex3fv( P8);   glColor4f(1.0f,0.0f,0.0f,0.5f);// Set Top Point Of Triangle To RedglVertex3fv( P8);// First Point Of The TriangleglColor4f(1.0f,0.0f,0.0f,0.5f);// Set Left Point Of Triangle To GreenglVertex3fv(P5);// Second Point Of The TriangleglColor4f(1.0f,0.0f,0.0f,0.5f);// Set Right Point Of Triangle To BlueglVertex3fv( P10);   glColor4f(1.0f,0.0f,0.0f,0.5f);// Set Top Point Of Triangle To RedglVertex3fv( P8);// First Point Of The TriangleglColor4f(1.0f,0.0f,0.0f,0.5f);// Set Left Point Of Triangle To GreenglVertex3fv(P11);// Second Point Of The TriangleglColor4f(1.0f,0.0f,0.0f,0.5f);// Set Right Point Of Triangle To BlueglVertex3fv( P5);   glColor4f(1.0f,0.0f,0.0f,0.5f);// Set Top Point Of Triangle To RedglVertex3fv( P7);// First Point Of The TriangleglColor4f(1.0f,0.0f,0.0f,0.5f);// Set Left Point Of Triangle To GreenglVertex3fv(P12);// Second Point Of The TriangleglColor4f(1.0f,0.0f,0.0f,0.5f);// Set Right Point Of Triangle To BlueglVertex3fv( P6);   glColor4f(1.0f,0.0f,0.0f,0.5f);// Set Top Point Of Triangle To RedglVertex3fv( P7);// First Point Of The TriangleglColor4f(1.0f,0.0f,0.0f,0.5f);// Set Left Point Of Triangle To GreenglVertex3fv(P9);// Second Point Of The TriangleglColor4f(1.0f,0.0f,0.0f,0.5f);// Set Right Point Of Triangle To BlueglVertex3fv( P6);   glColor4f(1.0f,0.0f,0.0f,0.5f);// Set Top Point Of Triangle To RedglVertex3fv( P12);// First Point Of The TriangleglColor4f(1.0f,0.0f,0.0f,0.5f);// Set Left Point Of Triangle To GreenglVertex3fv(P11);// Second Point Of The TriangleglColor4f(1.0f,0.0f,0.0f,0.5f);// Set Right Point Of Triangle To BlueglVertex3fv( P2);   glColor4f(1.0f,0.0f,0.0f,0.5f);// Set Top Point Of Triangle To RedglVertex3fv( P12);// First Point Of The TriangleglColor4f(1.0f,0.0f,0.0f,0.5f);// Set Left Point Of Triangle To GreenglVertex3fv(P2);// Second Point Of The TriangleglColor4f(1.0f,0.0f,0.0f,0.5f);// Set Right Point Of Triangle To BlueglVertex3fv( P6);   glColor4f(1.0f,0.0f,0.0f,0.5f);// Set Top Point Of Triangle To RedglVertex3fv( P9);// First Point Of The TriangleglColor4f(1.0f,0.0f,0.0f,0.5f);// Set Left Point Of Triangle To GreenglVertex3fv(P10);// Second Point Of The TriangleglColor4f(1.0f,0.0f,0.0f,0.5f);// Set Right Point Of Triangle To BlueglVertex3fv( P3);   glColor4f(1.0f,0.0f,0.0f,0.5f);// Set Top Point Of Triangle To RedglVertex3fv( P11);// First Point Of The TriangleglColor4f(1.0f,0.0f,0.0f,0.5f);// Set Left Point Of Triangle To GreenglVertex3fv(P5);// Second Point Of The TriangleglColor4f(1.0f,0.0f,0.0f,0.5f);// Set Right Point Of Triangle To BlueglVertex3fv( P2);   glColor4f(1.0f,0.0f,0.0f,0.5f);// Set Top Point Of Triangle To RedglVertex3fv( P5);// First Point Of The TriangleglColor4f(1.0f,0.0f,0.0f,0.5f);// Set Left Point Of Triangle To GreenglVertex3fv(P10);// Second Point Of The TriangleglColor4f(1.0f,0.0f,0.0f,0.5f);// Set Right Point Of Triangle To BlueglVertex3fv( P3);   glColor4f(1.0f,0.0f,0.0f,0.5f);// Set Top Point Of Triangle To RedglVertex3fv( P5);// First Point Of The TriangleglColor4f(1.0f,0.0f,0.0f,0.5f);// Set Left Point Of Triangle To GreenglVertex3fv(P2);// Second Point Of The TriangleglColor4f(1.0f,0.0f,0.0f,0.5f);// Set Right Point Of Triangle To BlueglVertex3fv( P3);   glColor4f(1.0f,0.0f,0.0f,0.5f);// Set Top Point Of Triangle To RedglVertex3fv( P9);// First Point Of The TriangleglColor4f(1.0f,0.0f,0.0f,0.5f);// Set Left Point Of Triangle To GreenglVertex3fv(P6);// Second Point Of The TriangleglColor4f(1.0f,0.0f,0.0f,0.5f);// 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();}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;}