Results 1 to 4 of 4

Thread: Light in openGL

  1. #1
    Junior Member Newbie
    Join Date
    Jan 2010
    Posts
    16

    Light in openGL

    Hello, dear community!
    I have 3D object. At the moment i have 1 light source - because of this when i rotate coordinate system around my object i see that object`s point colors changed because of angle to my light source. All i wanna do is to make light source that will light my object same from all points - so even if i rotate coordinate system - i shouldnt see that object`s point colors are changed - they must be always the same. Thank you.

  2. #2
    Junior Member Newbie
    Join Date
    Sep 2011
    Location
    Florence, Italy
    Posts
    18

    Re: Light in openGL

    With the fixed-functions pipeline, simply disable the lights.
    With shaders, simply use your diffuse color (from vertex or texture) directly as output of the fragment shader.

  3. #3
    Junior Member Newbie
    Join Date
    Jan 2010
    Posts
    16

    Re: Light in openGL

    If i disable the light, my object texture become black.

    For lighting i used :

    position : Array [0..3] of GLFloat = (0.0, 0.0, 3.5, 1.0);
    begin
    glLightfv (GL_LIGHT0, GL_SPECULAR , @position);
    glEnable (GL_LIGHTING);
    glEnable(GL_LIGHT0);

  4. #4
    Junior Member Newbie
    Join Date
    Sep 2011
    Location
    Florence, Italy
    Posts
    18

    Re: Light in openGL

    Have you tried to set the vertex color calling glColor()? The vertex color needs to be different than the default black, becouse it will be multiplied with the texture color.

Similar Threads

  1. How to add a light if white ambient light is active?
    By FedorSymkin in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 11-21-2014, 03:40 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. OpenGL Light!
    By imported_davie in forum OpenGL: Basic Coding
    Replies: 14
    Last Post: 07-26-2010, 07:07 AM
  5. Help with opengl es 2.0 light
    By MaximV in forum OpenGL: GLSL
    Replies: 6
    Last Post: 12-24-2009, 04:38 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