Hi Johannes,

I may be wrong but I have read Texture2DArry spec recently and I remember that clamp to border is not fully supported by this extension. Google and Look at Texture2DArray extension spec. You may need to switch to clamp to edge.

Cheers,
Wojtek

--------------------------------------------------
From: "Johannes Schüth" <[email protected]>
Sent: Sunday, October 04, 2009 11:19 PM
To: <[email protected]>
Subject: [osg-users] Texture Wrapping Texture2DArray (Clamping doesn't work)

Hi,

i have just changed my code to use Texture2DArray instead of texture2D's. I works fine but i have one problem. My texture is not clamped to the border.

This is my code:

Texture2DArray:

Code:

osg::Texture2DArray* textureArray = new osg::Texture2DArray;
textureArray->setFilter(osg::Texture2DArray::MIN_FILTER,osg::Texture2DArray::LINEAR);
textureArray->setFilter(osg::Texture2DArray::MAG_FILTER,osg::Texture2DArray::LINEAR);
textureArray->setWrap(osg::Texture::WRAP_S, osg::Texture::CLAMP_TO_BORDER); textureArray->setWrap(osg::Texture::WRAP_T, osg::Texture::CLAMP_TO_BORDER); textureArray->setWrap(osg::Texture::WRAP_R, osg::Texture::CLAMP_TO_BORDER);




Vertex Shader:

Code:

varying vec4 vPos;
void main()
{
vPos = gl_Vertex;
gl_Position = ftransform();
gl_FrontColor = gl_Color;
}




Fragment Shader:

Code:

#version 120
#extension GL_EXT_gpu_shader4 : enable

uniform sampler2DArray projectionMaps;
varying vec4 vPos;

void main()
{
vec4 coords = gl_TextureMatrix[5] * vPos;
vec4 dividedCoord = coords / coords.w ;
vec4 color = texture2DArray(projectionMaps, vec3((dividedCoord.st*vec2(0.5,0.5)+vec2(0.5,0.5)), 1));
gl_FragColor=color* gl_Color;
}




I add two images and one custom TexMat.
Is there a special way to enable clamping or might this be a bug in any form?


Thank you!

Cheers,
Johannes

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=17857#17857





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to