Alfonse_Reinheart:
You really need to read the GLSL 3.30 specification. Because you can access anything with “texelFetch,” which doesn’t use normalized texture coordinates. And you can get the size of a texture with the “textureSize” function. And OpenGL has supported NPOTs since GL 2.0. So there’s no need for you to use a rectangle texture here.
If the spec is too big, you could try reading the abridged version .
Is this the spec you are referring to? http://www.opengl.org/registry/doc/GLSLangSpec.3.30.6.pdf
I couldn’t find any reference to texelFetch in it by searching
ZbuffeR
January 26, 2011, 3:03am
22
Thanks I saw that. Unfortunately from what I read here , texelFetch doesn’t support wrap either :\
mobeen
January 26, 2011, 6:22am
24
I think you can do wrapping in shader using something like this,
vec4 leftVal=texture(texturemap, mod(uv.st+vec2(-1,0), textureSize()));
vec4 rightVal=texture(texturemap, mod(uv.st+vec2(1,0), textureSize()));
vec4 topVal=texture(texturemap, mod(uv.st+vec2(0,-1), textureSize()));
vec4 rightVal=texture(texturemap, mod(uv.st+vec2(0,1), textureSize()));
I am not sure if this works but u can try.
mobeen:
I think you can do wrapping in shader using something like this,
vec4 leftVal=texture(texturemap, mod(uv.st+vec2(-1,0), textureSize()));
vec4 rightVal=texture(texturemap, mod(uv.st+vec2(1,0), textureSize()));
vec4 topVal=texture(texturemap, mod(uv.st+vec2(0,-1), textureSize()));
vec4 rightVal=texture(texturemap, mod(uv.st+vec2(0,1), textureSize()));
I am not sure if this works but u can try.
I ended up doing this. It seems to work correctly, maybe some sort of problem with wrapping on the bottom edge but this was just a quick exercise anyway so I’m happy with it
Thanks all for the help on this one. Here’s a few vids of the results
1
2
3