Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 OpenGL Lighting/Shading/Texturing
Index -> Programming, C++ -> C++ Tutorials
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Homer_simpson




PostPosted: 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



Window.zip
 Description:

Download
 Filename:  Window.zip
 Filesize:  133.69 KB
 Downloaded:  270 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Homer_simpson




PostPosted: Tue Jun 10, 2003 6:44 pm   Post subject: (No 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?!
Catalyst




PostPosted: Tue Jun 10, 2003 6:52 pm   Post subject: (No subject)

declare

glEnable(GL_LIGHT1);

etc. and set them all up
Homer_simpson




PostPosted: Tue Jun 10, 2003 7:04 pm   Post subject: (No 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 =/
Display posts from previous:   
   Index -> Programming, C++ -> C++ Tutorials
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: