Results 1 to 2 of 2

Thread: Generate mipmaps using few textures

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2012
    Posts
    3

    Generate mipmaps using few textures

    Hey.

    I've been trying to have my font rendered nice and crisp even when downscaled (by projection, for example), so I figured I should create handmade mipmaps. No big deal - I just made few textures with different character sizes, providing me with textures I'd use for mipmapping.

    Now, the problem is, I can't find any good sources on generating a texture with custom mipmaps. What I basically have is something like this:

    Code :
    GLuint texture0, texture1, texture2, texture3; // textures of different sizes containing my character atlas'
    GLuint mipmappedTexture; // texture I want to use that will use previous 4 textures as mipmaps

    Maybe I'm getting something wrong, but how do I do it? Is that possible?

    By the way, if you have any better suggestions on how to make my font look nice and sharp even when downscaled, I'd be happy to hear them.

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    Posts
    3,112
    Quote Originally Posted by kamac496 View Post
    Now, the problem is, I can't find any good sources on generating a texture with custom mipmaps. What I basically have is something like this:

    Code :
    GLuint texture0, texture1, texture2, texture3; // textures of different sizes containing my character atlas'
    GLuint mipmappedTexture; // texture I want to use that will use previous 4 textures as mipmaps

    Maybe I'm getting something wrong, but how do I do it? Is that possible?
    It's possible, but it's not normally how you go about it. You don't normally start by creating each mipmap level as a separate texture. Instead, you create a single texture then upload (or render) the data for each level directly into that level.

    If you're generating the data for the mipmap levels in client memory, you use the level parameter of glTexImage2D, glTexSubImage2D, etc to specify which level you're uploading. If you're downsampling using render-to-texture, then you bind the appropriate level to the framebuffer by setting the level parameter for glFramebufferTexture or glFramebufferTexture2D accordingly.

Similar Threads

  1. Just Curious, How Many Mipmaps does glGenerateMipmap generate?
    By larryl in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 01-14-2017, 12:08 AM
  2. Mipmaps for GL_TEXTURE_2D_ARRAY do not generate
    By Vorril in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 09-01-2015, 02:53 AM
  3. Manually generate mipmaps for textures loaded using glCompressedTexImage2D
    By imported_Silverlan in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 09-19-2014, 06:20 PM
  4. Array Textures and Mipmaps
    By TimN8or in forum OpenGL: Advanced Coding
    Replies: 7
    Last Post: 03-29-2011, 02:50 PM
  5. SGIS auto-mipmaps & fp textures
    By demonoid in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 11-19-2004, 04:43 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