0

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

Edric
  • 24,639
  • 13
  • 81
  • 91
Laurane Bernard
  • 209
  • 1
  • 2
  • 10
  • 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 02 '13 at 12:58

1 Answers1

0

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

yaku
  • 3,061
  • 2
  • 19
  • 38