Take the 2-minute tour ×

I use a wood texture image in my model. by default my texture is stretched on the model you see this on woodark. When I changed the repeat the texture is more stretching and I are not understand why. I search to undertand how to use right the mapping in my model with base explain but I have found only examples with colors pixels.

thank to answers

share|improve this question
Typically in OpenGL you will have to define how the texture is applied. I haven't used WebGL though so it might be different then OpenGL. But typically you would use the functions glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT ); and so on. If this is applicable googling glTexParameteri. (there are also other versions of these functions, but hopefully it may help on the way). –  qrikko Jan 2 '13 at 12:58
add comment

1 Answer

up vote 0 down vote accepted

You should make sure your textures have power of two dimensions (ie. 256x256, 512x512 etc). Textures of arbitrary dimensions (NPOT) bring all kinds of mapping trouble in WebGL.

If you are unable to resize textures server-side, you can do it client-side. This link has some sample javascript code, as well as other relevant information: http://www.khronos.org/webgl/wiki/WebGL_and_OpenGL_Differences

share|improve this answer
yes it's true my texture was not 512x512 thank –  Laurane Bernard Jan 2 '13 at 13:42
add comment

Your Answer


