Results 1 to 3 of 3

Thread: 3D Objects Washed Out....Lighting Issues

  1. #1
    Junior Member Newbie
    Join Date
    Oct 2002
    Posts
    10

    3D Objects Washed Out....Lighting Issues

    Hey all,
    In my 3D scene I have a glutsolid torus, but when I render the scene my object is completely white, it has to be my lighting source. But Im not sure what I'm doing wrong.
    Can someone please help, its driving me nuts here's my display function. Thanks guys

    void Display(void)
    {
    // Material ambience is the light that is reflected
    // from the material from the light sources in every
    // direction to the rest of the scene.

    GLfloat mat_ambient[] = { 0.7f, 0.7f, 0.7f, 1.0f};

    //Color of object to be
    GLfloat mat_diffuse[] = { .6f, 0.6f, 0.6f, 1.0f};

    //Specular allows you to control the effect the material
    //or object has on the highlights
    GLfloat mat_specular[] = {1.0f,1.0f,1.0f,1.0f};

    //light that is being produced by the object
    GLfloat mat_shininess[] = {80.0f};

    glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient); //set initial ambience
    glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse); //set intial diffusion color
    glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular); //set initial specular settings
    glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess); //set initial shininess for objects

    GLfloat lightIntenisity[] = { 0.9f, 0.9f, 0.9f, 1.0f};

    GLfloat light_position[] = {29.0f, 0.0f, 0.0f, 0.0f};

    glLightfv(GL_LIGHT0, GL_POSITION, light_position);
    glLightfv(GL_LIGHT0, GL_DIFFUSE, lightIntenisity );

    glClear(GL_COLOR_BUFFER_BIT);
    glLoadIdentity();
    Camera.Render();
    glTranslatef(0.0,0.8,0.0);

    glScalef(3.0,1.0,3.0);



    //PURPLE DONUT OBJECT
    glPushMatrix();
    glRotated(-90, 1, 0, 0.0);
    glScaled(0.08, 0.08, 0.0;
    GLfloat donut_diffuse[] = { 0.6f, 0.0f, 1.0f, 1.0f};
    glMaterialfv(GL_FRONT, GL_DIFFUSE, donut_diffuse);
    glutSolidTorus(.5,2,90,90);
    glPopMatrix();

    glFlush();
    glutSwapBuffers();

    }

  2. #2
    Member Newbie
    Join Date
    Nov 2002
    Location
    paris, france
    Posts
    37

    Re: 3D Objects Washed Out....Lighting Issues

    try to add glEnable(GL_LIGHT0); after you set light parameters.

    have fun
    cb
    Sébastien Kuntz
    SNCF VR Lab

  3. #3
    Member Newbie
    Join Date
    Nov 2002
    Location
    paris, france
    Posts
    37

    Re: 3D Objects Washed Out....Lighting Issues

    oh and glEnable(GL_LIGHTING); too =))

    have fun!
    cb
    Sébastien Kuntz
    SNCF VR Lab

Similar Threads

  1. Help with OpenGL lighting issues on windows 7
    By ejosiah in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 07-28-2015, 02:39 PM
  2. Lighting issues (very basic)
    By davoring in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 08-15-2014, 12:49 PM
  3. Performance issues rendering a lot of different objects.
    By kaberdock in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 03-30-2014, 10:31 PM
  4. FBO depth map almost completely washed out
    By iwdec in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 04-18-2011, 01:36 AM
  5. material and lighting issues - help
    By in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 12-16-2002, 10:23 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