Results 1 to 3 of 3

Thread: Light Rotation using C++

  1. #1
    Junior Member Newbie
    Join Date
    May 2009
    Posts
    7

    Light Rotation using C++

    Hello,This is the first time for me to post in a forum and I hope that this will help me.
    I need to ask how can I animate the light and make it rotate around a sphere..
    I think it is easy but I can't get it
    Thank u in advance

  2. #2
    Senior Member Regular Contributor
    Join Date
    Oct 2009
    Posts
    132

    Re: Light Rotation using C++

    There is a redbook sample for this here:

    http://www.opengl.org/resources/code...ok/movelight.c

    if you want to make the torus a sphere change the line that reads

    Code :
    glutSolidTorus (0.275, 0.85, 8, 15);

    to something like this:

    Code :
    glutSolidSphere(1.0, 20, 20);


    the part you are interested in is here:

    Code :
       glPushMatrix ();
       glRotatef (spin, 1.0, 0.0, 0.0);
       glLightfv (GL_LIGHT0, GL_POSITION, position);
     
       glTranslated (0.0, 0.0, 1.5);
       ...
       glPopMatrix ();

    which rotates the light by spin degrees at a distance of 1.5 from the sphere.

  3. #3
    Junior Member Newbie
    Join Date
    May 2009
    Posts
    7

    Re: Light Rotation using C++

    Thank u James very much =)

Similar Threads

  1. 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
  2. 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
  3. Strange behavoir with Light + rotation
    By PureSpider in forum OpenGL: Basic Coding
    Replies: 14
    Last Post: 10-10-2008, 05:46 AM
  4. changing axis of rotation and center of rotation in openGL performer
    By ravishashi in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 07-08-2003, 04:42 AM
  5. 3d light rotation
    By in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 08-28-2002, 08:56 AM

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