Recommended Posts

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?

Share this post

Link to post

Share on other sites

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?