Tiling a texture

Started by
3 comments, last by Madhed 19 years, 3 months ago
One thing's been bothering me. What I intend to do is take a texture from a bitmap containing, say, 4x4 sets of 64x64 textures (as opposed to 12 bitmaps with 64x64 textures), and apply it to my objects (ie, the level, in this case.) The only information I could find involved creating an individual texture for each of the 12 images in my bitmap with glGenTexture() and specifying GL_REPEAT as a parameter. This works, but I have two problems. 1- Can I just create a single texture and specify which of the 12 textures in it I want to use as the texture coordinates? This works fine, but the texture isn't repeated because... 2- ...GL_REPEAT only works if you give it texture coordinations greater than 1.0. What I want it to do is tile, for example, such as that it would be repeated 4x (2x2) in a quad occupying (0.0,0.0)-(2.0,2.0). One workaround is to create a texture for each of the 12 images. Is this the right way to do it, a bad idea, or what? An other would be to subdivide my 2.0x2.0 quad into four 1.0x1.0 quads, but that seems like it'd be even less efficient. Any advice and/or pointers?
Advertisement
sorry to say that but you're out of luck.
It would be possible with a pixel shader though.
(I think it's called fragment program in ogl)
But I'm wondering if it's worth the effort
ahhhh that was me :)
Wow, that was fast. :P

Unfortunately, I'm working with some pretty low-end specs (my PC is an old beast, hehe) so I doubt I could do much with a pixel shader (ATI RAGE 128; believe me, an upgrade wouldn't hurt one bit!) Thanks for the idea, though!

So I suppose this means the best solution, given my predicament, would be to create individual textures using that image as a basis, and figuring out a way to dynamically (I'm trying to cut down on stuff stored in my map file) stretch my texture such as that it would tile more or less like I said? Or is there already some way to do this or an extension that could do it?

Thanks :)
hm, i have only programmed direct 3d so far but to tile the textures i simply provide texture coordinates beyond 1.0f. That works

This topic is closed to new replies.

Advertisement