Results 1 to 3 of 3

Thread: My light transforms but it shouldn't.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    You are setting light position after you have rendered. Try swapping lines like this:
    Code:
    glRotatef(Camera.Rotation.X, 1, 0, 0);
        glRotatef(Camera.Rotation.Y, 0, 1, 0);
        glTranslatef(-Camera.Position.X, -Camera.Position.Y, -Camera.Position.Z);
        glLightfv(GL_LIGHT0, GL_POSITION, LightPosition); // Set light after camera
        Entity.Draw; //draws the one visible object

  2. #2
    Quote Originally Posted by User137 View Post
    You are setting light position after you have rendered. Try swapping lines like this:
    Code:
    glRotatef(Camera.Rotation.X, 1, 0, 0);
        glRotatef(Camera.Rotation.Y, 0, 1, 0);
        glTranslatef(-Camera.Position.X, -Camera.Position.Y, -Camera.Position.Z);
        glLightfv(GL_LIGHT0, GL_POSITION, LightPosition); // Set light after camera
        Entity.Draw; //draws the one visible object
    Thanks mate, it works!

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •