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

Thread: Incresing texture border width

  1. #1
    Junior Member Regular Contributor
    Join Date
    Dec 2012
    Posts
    101

    Incresing texture border width

    Hello, I know the default border can be set as follow:

    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);

    float color[] = { 1.0f, 0.0f, 0.0f, 1.0f };
    glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, color);

    But I'd like to know how to increase or decrease the border width?

    Thanks.

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    Posts
    2,587
    The border doesn't have a width. The "border" is everything that's outside of the texture.

  3. #3
    Senior Member OpenGL Pro
    Join Date
    Jan 2007
    Posts
    1,748
    The border width is set via the border parameter to glTexImage2D and cannot be subsequently changed. In older versions of OpenGL there were only two valid values for it: 0 or 1. Newer versions of OpenGL require it to be 0.

    The idea behind texture border, border colour and clamp-to-border mode is that any texture addressing outside of the 0..1 range will, if a border is specified, use the border colour. A border width of anything other than 0 or 1 therefore makes no sense: texture border is binary; it's either there or not. The fact that you seem to be asking to dynamically change this behaviour at runtime, and possibly set width other than 0 or 1, suggests that you have some specific behaviour in mind that you want to have happen. It may be more helpful if you tell us what you actually want to do here.

  4. #4
    Junior Member Regular Contributor
    Join Date
    Dec 2012
    Posts
    101
    That's what I was about to ask, I'm using OpenGL version 4.3 and it seems it doesn't matter whether the border is set to 0 or 1. Why?

  5. #5
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    Posts
    2,587
    Quote Originally Posted by Lee_Jennifer_82 View Post
    That's what I was about to ask, I'm using OpenGL version 4.3 and it seems it doesn't matter whether the border is set to 0 or 1. Why?
    In the OpenGL 3+ core profile, the border parameter to glTexImage2D() etc must be zero, otherwise a GL_INVALID_VALUE error is generated. In theory, it should still work in a compatibility profile, although personally I wouldn't count on it. Texture borders have a history of being poorly supported.

Posting Permissions

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