Sign in to follow this  

Tiling a texture

This topic is 4716 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Guest Anonymous Poster
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

Share this post


Link to post
Share on other sites
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 :)

Share this post


Link to post
Share on other sites

This topic is 4716 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this