08 Jun 2014, 14:21
Generic-user-small

K. Hornig (2 posts)

Hello,

first I want to thank for this book. It’s nice to read and excellent to follow!

Based on chapter 7, I would like to know how to repeat a texture. I read about GL_REPEAT, G_CLAMP_TO_EDGE and GL_MIRRORED_REPEAT, but it doesn’t have any effect. It seems I missed somewhere the point.

Can someone help me? Thanks!

12 Jun 2014, 13:25
Generic-user-small

Kevin Brothaler (36 posts)

Thank you :) For repeating textures you’ll first want to adjust the texture coordinates so that your texture ranges over more than [0, 1]. For example, you can double the coordinates to [0, 2] which should cause it to repeat once. Could you try that with GL_REPEAT?

i.e.

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);

12 Jun 2014, 13:29
Generic-user-small

Kevin Brothaler (36 posts)

So for example if you try that with chapter 7 by doubling the texture coordinates in Table.java and adding the lines above to TextureHelper.java, you could get something like this:

http://imgur.com/DTz37SR

14 Jun 2014, 14:31
Generic-user-small

K. Hornig (2 posts)

Hi Kevin,

thank you for the answer! Now it works. :-) The point was: texture ranges over more than [0, 1].

18 Jun 2014, 23:54
Generic-user-small

Kevin Brothaler (36 posts)

No problem, glad that it worked out :)

  You must be logged in to comment