Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 10 of 10

Thread: glShadeModel is depreciated. So, how, exactly, do we do flat shading now?

Hybrid View

  1. #1
    Intern Contributor
    Join Date
    Jan 2001
    Posts
    82

    Question glShadeModel is depreciated. So, how, exactly, do we do flat shading now?

    I want to make a retro-style game like Spectre. I'm trying to stay away from depreciated functions. I DO understand that it will work for the foreseeable future. Still, depreciated means going away at some point and I would like to stay ahead of that.

    The problem is that the only way to do flat shading that I can find is via glShadeModel. I cannot find any method of doing flat shading via the programmable pipeline and what little I could find mentioning flat shading states that it cannot be done. Is this correct?

    The only idea that I can come up with is to do all transformations and lighting calculations on the CPU side and send the calculated polygon shade to the GPU via a uniform. That doesn't seem to be the most efficient method. Unfortunately, it seems to be the *only* method.

    How can I do this? Is this going to be addressed in a future gl version? Flat shading is still needed in 3D modelers and CAD/CAM applications.

  2. #2

  3. #3
    Intern Contributor
    Join Date
    Jan 2001
    Posts
    82
    Thanks! I had no idea such a concept existed! Now to find an example...

  4. #4
    Junior Member Regular Contributor
    Join Date
    Apr 2006
    Location
    Kyoto.
    Posts
    129
    Quote Originally Posted by MarkS View Post
    Thanks! I had no idea such a concept existed! Now to find an example...
    http://www.opengl.org/discussion_boa...22#post1169422

    this method, using dFdx/dFdy, also works and doesn't require normals

  5. #5
    Intern Contributor
    Join Date
    Jan 2001
    Posts
    82
    Awesome! I like that idea better. It will let me support GL 2.x.

  6. #6
    Senior Member OpenGL Pro
    Join Date
    Apr 2010
    Location
    Germany
    Posts
    1,129
    Quote Originally Posted by MarkS
    Thanks! I had no idea such a concept existed!
    BTW, even if GLSL didn't do this for you and only offered perspective-correct (bi)linear interpolation, you could still get them same effect by simply putting out the same color for all vertices of the current primitive.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •