Results 1 to 2 of 2

Thread: Rendered Model Appears Flat (e.g., no shading)

  1. #1
    Junior Member
    Join Date
    Feb 2010
    Posts
    1

    Rendered Model Appears Flat (e.g., no shading)

    Hi All,
    I'm new to opengl es, so this question may be silly but I can't seem to find the answer elsewhere.

    I'm developing a feature for one of our iPhone apps that requires the use of opengl es 1.1. The model is dynamically generated based on inputs from the accelerometer. The model generation seems to be working fine with the exception of the shading; no matter what I do the model appears flat (e.g., no shading). I've tried moving the light source to various locations, which changed the overall brightness of the model, but has no effect on the shading the contours of the model.

    Here are some details on the model and things I've tried:

    1) A png based texture is mapped to the model
    2) The model is drawn using triangle strips
    3) I've triple checked that the vertex normals are properly calculated
    4) I've tried to remove the texture and render with a simple Opengl material and it still appears flat
    5) I've explicitly set the shade model to GL_SMOOTH

    With my limited OpenGL experience I'm at a loss as to what I should try next. Any help would be GREATLY appreciated.

  2. #2
    Junior Member
    Join Date
    Feb 2010
    Posts
    2

    Re: Rendered Model Appears Flat (e.g., no shading)

    Hi iApps,
    I'm not sure if this will help, but it's worth a shot.
    I assume by 'flat', you mean you can see the shapes of the triangles, so it looks like your model is made from flat pieces of plastic.

    Your right that you should be enabling gl_smooth, but you might need a few more flags set too.

    Here is the few that come to mind that may be causing your current situation:
    glEnable(GL_LIGHTING); (This makes sure that lighting is calculated (including shading))
    glShadeModel(GL_SMOOTH); (This turns on smoothing, like you already mentioned)
    glEnable(GL_DEPTH_TEST); (This is used to make sure things are sorted properly before being drawn, depending on your model, this can cause all sorts of weird looking symptoms.)

    Let me know how that works out. If it doesn't help, then try changing the shade model to gl_flat, see if it looks any different.
    Also, if you can post a screen shot that might help understand whats going on.

    SilicaGel.

Similar Threads

  1. cell shading
    By johan in forum Developers Coding:Beginner
    Replies: 0
    Last Post: 12-29-2011, 06:17 AM
  2. Not all faces being rendered?
    By cristian.vrabie in forum OpenGL ES 1.X - fixed function hardware
    Replies: 2
    Last Post: 04-30-2010, 03:55 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
  •