Results 1 to 6 of 6

Thread: GL_INTENSITY

  1. #1
    Junior Member Newbie
    Join Date
    Nov 2003
    Location
    Brighton, United Kingdom
    Posts
    12

    GL_INTENSITY

    I have a greyscale texture map that I wish to use as a font map, containing anti-aliased glyphs of individual characters, so ideally I want each texel to represent both luminance and alpha values, that is, GL_INTENSITY. The thing is, glTexImage2D does not support GL_INTENSITY as a format for the texel data. Is there a way around this, or do I have to double each byte in the texture map so I can use the valid GL_LUMINANCE_ALPHA?
    J. Gareth "Crane" Moreton - Chief Programmer of Garjen Software

  2. #2
    Senior Member OpenGL Pro Zengar's Avatar
    Join Date
    Sep 2001
    Location
    Germany
    Posts
    1,931

    Re: GL_INTENSITY

    I guess using GL_APHA (or GL_RED/BLUE etc.) as format would do the trick (only a suggestion, I have never done it myself).

  3. #3
    Senior Member OpenGL Guru
    Join Date
    Mar 2001
    Posts
    3,574

    Re: GL_INTENSITY

    The thing is, glTexImage2D does not support GL_INTENSITY as a format for the texel data.
    It doesn't specify it as an external format. Any single-component format will do; I use GL_LUMINANCE even though the internal format is GL_INTENSITY.

  4. #4
    Junior Member Newbie
    Join Date
    Nov 2003
    Location
    Brighton, United Kingdom
    Posts
    12

    Re: GL_INTENSITY

    So would something along the lines of the following would do the trick, or is there a catch?

    (Pascal Code)

    Code :
    glTexImage2D(
      GL_TEXTURE_2D,
      0,
      GL_INTENSITY,
      Width,
      Height,
      0,
      GL_LUMINANCE,
      GL_UNSIGNED_BYTE,
      PixelData
    );
    J. Gareth "Crane" Moreton - Chief Programmer of Garjen Software

  5. #5
    Senior Member OpenGL Pro k_szczech's Avatar
    Join Date
    Feb 2006
    Location
    Poland
    Posts
    1,107

    Re: GL_INTENSITY

    Yes, it should work.
    However you may not get what you want if you use GL_INTENSITY.
    I would suggest using alpha-only texture.

    When rendering fonts you usually want it to have constant color and variable opacity. You don't want them to be darker on edges.

  6. #6
    Senior Member OpenGL Guru
    Join Date
    Mar 2001
    Posts
    3,574

    Re: GL_INTENSITY

    Of course, if your shader simply replaces the RGB with the font color, there's no problem. But, then again, a GL_ALPHA texture accomplishes the same thing a bit more explicitly.

Similar Threads

  1. GL_LUMINANCE vs. GL_INTENSITY
    By Jan in forum OpenGL: Advanced Coding
    Replies: 4
    Last Post: 08-25-2003, 02:52 PM
  2. GL_INTENSITY?
    By Nocturnal in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 08-25-2001, 11:00 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