I experiencing issues when using large textures in the following code environment where I am using OpenGL to visualize image projections:
I am projecting the textures onto polys and I wish to clamp using a border to extend out the border color beyond the texture. A call to glGetIntegerv(GL_MAX_TEXTURE_SIZE, … ) in my implementation returns 4096. Thus, per all documentation I have read, the max size is actually 4098 with borders included.
When I use a square texture of 4098 the border seems not to be respected on what is the bottom and right side of my texture image. The top and left of my texture image are “clamped” properly, but the bottom and right sides get “clamped” using information from the texture image proper and not the border. This also occurs when using a square texture of 2050 (2048 + 2 for border). I have to go all the way down to 1026 in order for the clamping aspect to work as expected.
It seems that there is something beyond the MAX_TEXTURE_SIZE that is coming into play here when using clamped borders. It appears that one cannot only rely solely upon information obtained by glGetIntegerv(GL_MAX_TEXTURE_SIZE, … ) in order to get things running properly. The main concern is that I have no idea what the other limitations are.
To make sure I am using border and clamping properly . . . I am taking my texture image proper and copying the information into the center of a buffer that is two pixels larger in either dimension, leaving a single pixel border on all sides. This single pixel border is of the color I wish to use when clamping. Is this correct?
Speaking of which, if you must build your own border into your buffer, what is the purpose of calling ‘glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, borderColor)’?