Computer Science Canada

OpenGL Lighting/Shading/Texturing

Author:  Homer_simpson [ Sun Jun 08, 2003 1:42 pm ]
Post subject:  OpenGL Lighting/Shading/Texturing

use "a" and "z" to enable and disable Lighting
use "s" and "x" to enable and disable Texturing

Author:  Homer_simpson [ Tue Jun 10, 2003 6:44 pm ]
Post subject: 

this is my init part
code:
BOOL Init() {
    GLfloat mat_specular[] = { 1.0, 1.0,1.0, 1.0 };
    GLfloat mat_shininess[] = { 50.0 };
    GLfloat light_position[] = { 1.0, 1.0, 0.0, 1.0 };

    glMaterialfv(GL_LIGHT1, GL_SPECULAR, mat_specular);
    glMaterialfv(GL_LIGHT1, GL_SHININESS, mat_shininess);
    glLightfv(GL_LIGHT1, GL_POSITION, light_position);


      glShadeModel(GL_SMOOTH);       
      glClearColor(0.0, 0.0, 0.0, 0.0);   
      glClearDepth(1.0);                               
      glEnable(GL_DEPTH_TEST);       
     glEnable(GL_TEXTURE_2D);
      glDepthFunc(GL_LEQUAL);            
          if(BitmapLoad("flag.bmp",  0) == FALSE) 
          {
                  return (FALSE);                     
          }
          if(BitmapLoad("crate.bmp", 1) == FALSE)
          {
                  return (FALSE);                     
          }

          if(BitmapLoad("flag2.bmp", 3) == FALSE)
          {
                  return (FALSE);                     
          }

    glEnable(GL_LIGHTING);
        glEnable(GL_LIGHT0);
    glDepthFunc(GL_LEQUAL);
    glEnable(GL_DEPTH_TEST);

        }

Does anyone know how i can have more than one light source?!

Author:  Catalyst [ Tue Jun 10, 2003 6:52 pm ]
Post subject: 

declare

glEnable(GL_LIGHT1);

etc. and set them all up

Author:  Homer_simpson [ Tue Jun 10, 2003 7:04 pm ]
Post subject: 

how?!
i mean not how...
i tried didn't work for some reason i declare new glfloats i enable glligh1 it doesn't create new light =/


: