Results 1 to 4 of 4

Thread: rotate with fixed lighting

  1. #1
    Junior Member Newbie
    Join Date
    Oct 2009
    Posts
    6

    rotate with fixed lighting

    I have 2 triangles and I'm rotating them. It seemed as if the lightsource didn't rotate with them, so I rotated it explicitly, but still it looks weird. The upper triangle brightens up just before turning backward.

    Here's a video about it: http://www.youtube.com/watch?v=Dgc0k_hUcIY

    The code I tried:

    Code :
    void update(){
    		glMatrixMode(GL_MODELVIEW);		
    		glLoadIdentity(); //Reset the camera
     
    		gluLookAt
    		(sin(angle)*3,cos(angle)*3,0.4,
    		0.0,0.0,0.0,
    		0.0,0.0,1.0);
     
     
    		GLfloat lightPos0[] = {sin(angle+80.0), cos(angle+80.0), 0.1f, 1.0f};
    		glLightfv(GL_LIGHT0, GL_POSITION, lightPos0);
     
    		angle = angle + 0.03;
    		glutPostRedisplay();
    }

  2. #2
    Junior Member Newbie
    Join Date
    Oct 2009
    Posts
    6

    Re: rotate with fixed lighting

    So basically my question is: should I rotate the lights explicitely?

  3. #3

    Re: rotate with fixed lighting

    sorry didnt read your post cearfully before so i deleted my post

  4. #4
    Junior Member Newbie
    Join Date
    Oct 2009
    Posts
    6

    Re: rotate with fixed lighting

    I just write a reply to move it up in activity list.

Similar Threads

  1. Position light fixed when rotate object
    By wesleyide in forum OpenGL ES
    Replies: 1
    Last Post: 04-01-2013, 03:23 PM
  2. How to specify a fixed lighting direction?
    By NomadUK in forum COLLADA
    Replies: 0
    Last Post: 05-25-2012, 06:43 AM
  3. fixed lighting
    By whatman in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 02-21-2004, 02:27 PM
  4. fixed lighting.
    By imported_Jules in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 05-06-2002, 05:52 AM
  5. How to rotate about FIXED axes?
    By JiauFoo in forum OpenGL: Basic Coding
    Replies: 16
    Last Post: 04-10-2001, 10:30 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