Results 1 to 3 of 3

Thread: GL_SMOOTH & normals issues

  1. #1
    Junior Member Newbie
    Join Date
    Mar 2011
    Posts
    3

    GL_SMOOTH & normals issues

    Hi,
    I have been looking all over the web for a way to use GL_Smooth in my project and I have found out that it has something to do with vertex normals,
    but i wasnt able to make it work for me, can someone in here help me or direct me please to some guide that will tell me how to use them?
    My drawing function looks like this:

    glClear (GL_COLOR_BUFFER_BIT);
    glPushMatrix();

    glLoadIdentity();

    x = radius * cos(rotX) * cos(rotY);
    y = radius * sin(rotX);
    z = -radius * cos(rotX)* sin(rotY);

    gluLookAt(x,y,z,0,0,0,0,1,0);

    glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
    glShadeModel( GL_SMOOTH );

    glutSolidSphere(.5, 20, 20);

    glPopMatrix();
    glutSwapBuffers();
    when everything else that i need to do works good(I needed to create a 3d "Flythrough mode" using the arrow keys which worked, the the only problem i have now is making it use the GL_SMOOTH Shading feature)

    Thanks a lot (=

  2. #2
    Senior Member Regular Contributor
    Join Date
    Nov 2010
    Location
    Brazil, Rio de Janeiro
    Posts
    147

    Re: GL_SMOOTH & normals issues

    Didn't get the problem. What your code does is to set up the camera location, this is not to do with vertex normals of your model. What exactly you are getting when GL_SMOOTH is enabled?

    I think you should know that GL_SMOOTH requires a per-vertex normal to work properly, maybe that's is the problem.

    take a look at glNormal

  3. #3
    Junior Member Newbie
    Join Date
    Mar 2011
    Posts
    3

    Re: GL_SMOOTH & normals issues

    thanks for the quick answer,
    no i wasnt able to do that right yet
    am i suppose to calculate the normal for each vertex or will it be enough to write:

    glNormal3f(curr.x,curr.y,curr.z);
    glVertex3f(curr.x, curr.y, curr.z);
    beacuse if it is so simple than i have encountered a problem with the lighting now - it doesnt look as it should have been( i need to make a "Diffuse reflection" light model)
    and again thanks you really helped me getting in the right direction

Similar Threads

  1. GL_SMOOTH interpolation causes highlights on edges of triangles
    By zaphara in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 11-03-2013, 08:11 PM
  2. some matters on glShadeModel(GL_SMOOTH);
    By mycral in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 03-16-2010, 08:02 PM
  3. Offset and problems with GL_SMOOTH
    By in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 06-21-2004, 12:56 AM
  4. GL_SMOOTH artefacts
    By Eric in forum OpenGL: Advanced Coding
    Replies: 4
    Last Post: 07-14-2000, 08:22 AM
  5. I can't get GL_SMOOTH to work
    By in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 03-03-2000, 01:32 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