PDA

View Full Version : GL_TEXTURE_2D_ARRAY_EXT issue regarding CLAMP_TO_B



Jotschi
10-08-2009, 01:53 PM
Hello,

i have a problem regarding the extension GL_TEXTURE_2D_ARRAY_EXT. I need to clamp my textures which i added to an GL_TEXTURE_2D_ARRAY to the border so i definded the GL_TEXTURE_WRAP T and S to CLAMP_TO_BORDER:

glTexParameterf(GL_TEXTURE_2D_ARRAY_EXT, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
glTexParameterf(GL_TEXTURE_2D_ARRAY_EXT, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);

But this does not work with ati cards/drivers. Nvidia cards/drivers work just fine. I tested ATI 4850 and 4890.

I known this is an driver issue but i need to find a workaround for this problem.

An example source code file can be downloaded here:
http://www.jotschi.de/download/opengl_texture_array_glsl_example.tgz

You can switch from GL_TEXTURE_2D to GL_TEXTURE_2D_ARRAY by enabling or disabling: #define NOARRAY

Here can you see that the clamping is not applied when texture arrays are used:


http://www.jotschi.de/wp-content/uploads/2009/10/GL_TEXTURE_2D_ARRAY_CLAMP_TO_BORDER-ATI.png

In contrast to clamping when texture_2d's are used:

http://www.jotschi.de/wp-content/uploads/2009/10/GL_TEXTURE_2D_CLAMP_TO_BORDER-ATI.png

I need to clamp those texture to add them next to each other onto the same object by using different texture coordinated. Imagine a Chessboard where each field is a unique texture. If clamping to border would work each texture would only cover it own 'field'. But since this does not work and i do need texture arrays i need to find a solution.

Greetings,

Jotschi

Jotschi
10-11-2009, 07:20 AM
Hi,

i think i found a workaround that will work for me. I just implemented the clamping in my fragment shader myself :)


#extension GL_EXT_gpu_shader4 : enable

uniform sampler2DArray base_texture;
varying vec2 texCoord;
void main()
{

vec4 borderColor =vec4(0.1,0.7,0.2,0.1);
if(texCoord.s<1 &amp;&amp; texCoord.s >0 &amp;&amp; texCoord.t <1 &amp;&amp; texCoord.t >0)
{
borderColor = texture2DArray(base_texture, vec3(texCoord.st,1));
}
gl_FragColor = borderColor;

}

No need to buy another graphicscard ;)

Cheers,
Johannes

Graham Sellers
11-20-2009, 10:53 AM
Hey Johannes,

I know this is a couple of months old now, but can you tell me what Catalyst version you're using? I was unable to reproduce this either on the latest Catalysts or any internal driver build. If this is still happening for you on the latest Catalysts (9.11), we'll dig deeper.

Cheers,

Graham

Jotschi
11-21-2009, 10:01 AM
Hi,

i discovered this issue with fglrx 9.7 and i can reproduce it with 9.11.

See http://ati.cchtml.com/show_bug.cgi?id=1691 for example code.

I do not know if the windows drivers are affected by this problem. But the Linux ones are.

Greetings,

Jotschi