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.

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.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.