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 3 of 3

Thread: Manual glGenerateMipMap generation in C++

  1. #1
    Intern Contributor
    Join Date
    Nov 2011
    Posts
    59

    Manual glGenerateMipMap generation in C++

    Hello,

    I am considering replacing glGenerateMipMap with a manual C++ based mipmap generation when
    loading normal maps (since I read it makes sense to normalize them for each mip map level
    EVEN when the normals will be anyway normalized in the shader later).

    Anyone knows code examples for this? Probably a simple box filter should do the trick.

    Thanks!
    ++i--;

  2. #2
    Member Regular Contributor
    Join Date
    Jul 2012
    Posts
    418
    This might help.

  3. #3
    Intern Contributor
    Join Date
    Nov 2011
    Posts
    59
    Thanks for the link!

    For non power of two textures it seems to be more complicated to achieve good results: http://download.nvidia.com/developer...p_Creation.pdf

    So for now I restrict my normal maps to power of two dimensions.

    I have implemented it this way:

    For each pixel:
    1. Read 4x RGB values from parent level and convert them to 4 normals
    2. Add the 4 normals together and normalize the result
    3. Convert the normalized result to RGB again and store it in the current level

    Hope that is ok?
    Last edited by RealtimeSlave; 08-13-2017 at 08:21 AM.
    ++i--;

Posting Permissions

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