opengl - Why is my texture streching even on using GL_REPEAT? -


enter image description herethis output :![enter image description here][2]

the image stretched when walls long , squeezed when small.

my code loading texture, loadtgatexture method superbible.

glgentextures(1,&texture);   glbindtexture(gl_texture_2d,texture);    loadtgatexture(texturefile, gl_linear_mipmap_linear, gl_linear, gl_repeat); 

the code snippet giving texture coordinates : (j index of wall of building)

    buildingarray[j][0] = n2.x;     buildingarray[j][3] = 0;     buildingarray[j][4] = n2.y;      texblgarray[j][0] = repeat_after_length;     texblgarray[j][5] = 0;      normals[j][0] = normal.x;     normals[j][6] = normal.y;     normals[j][7] = normal.z;      j++; 

i set repeat after length 1.

i think texture gl_repeat happens if length > 1, should set value greater one, if so, windows in texture become small , large no. of windows visible. want tile texture, dont want change in dimensions of orignal texture image :enter image description here

what doing wrong ?

your texture coordinates normalized on long walls (i.e. have [0,0] @ left corner , [1,1] @ bottom right). if want texture repeat need coordinates exceeding 1.0. so, if length of triangle side x, texture should range on x * k.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -