Results 1 to 2 of 2

Thread: Light and Translate

  1. #1
    Junior Member Newbie
    Join Date
    May 2011
    Posts
    3

    Light and Translate

    hello everyone,
    when I draw a solidsphere at (1,0,0) and shading it as below

    GLfloat lightIntensity[]={0.7f, 0.7f, 0.7f, 1.0f};
    GLfloat light_position[]={0.1, 0, 0.0f, 0.0f};
    glLightfv(GL_LIGHT0, GL_POSITION, light_position);
    glLightfv(GL_LIGHT0, GL_DIFFUSE, lightIntensity);
    ....
    glPushMatrix();
    glTranslated(1,0, 0.0); // sphere at (1, 0, 0.0)
    glutSolidSphere(0.3, 10, ;
    glPopMatrix();

    in this case we have:

    origin --> light source(0.1,0,0) --> solidsphere (1,0,0)

    i think the left side of solidsphere is lighted, but when i run the program , the right side of solidsphere is lighted

    )I think this problem because OpenGL draw solidsphere at (0,0,0) and tranlate in to (1,0,0))
    can I solve this problem??

  2. #2
    Junior Member Newbie
    Join Date
    May 2011
    Posts
    3

    Re: Light and Translate

    ok!. I have just solved this problem. very simple!^^

Similar Threads

  1. Replies: 0
    Last Post: 03-19-2014, 10:11 PM
  2. Positioned spot light - white light appearing from nowhere behind
    By windchine in forum OpenGL: Basic Coding
    Replies: 9
    Last Post: 08-03-2012, 02:30 AM
  3. Fixed light and moving spot light with the mouse
    By Jorcelangelo in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 04-18-2012, 09:56 PM
  4. translate; scale; translate;
    By in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 04-25-2004, 03:28 AM
  5. Represent Rotate and Translate by one Translate
    By Luin in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 07-02-2000, 01:54 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean