PDA

View Full Version : Texture wrap question



napalm21
01-26-2003, 07:17 AM
I know how to wrap a texture across a polygon, but how do I wrap only part of that texture around a polygon. For example, if i have a texture made up of 4 colored squares, one white, one green, one blue, and one red. how would i wrap only the blue part across my polygon instead of all of the texture?

Claude
01-26-2003, 11:02 AM
A texture has its own coordinate system from (0.0,0.0) to (1.0,1.0). If you want the top
right square of a texture to map onto a polygon specify the UVcoords as (0.5,0.5) to (1.0,1.0).

Hope it helps Claude

01-26-2003, 12:56 PM
You asked the same thing I was wondering here (http://www.opengl.org/discussion_boards/ubb/Forum2/HTML/011529.html). I would also like to know if this is even possible...

napalm21
01-26-2003, 02:01 PM
I know how to use only a section of teh texture http://www.opengl.org/discussion_boards/ubb/smile.gif i do not know how to wrap a small chunk of a texture.

I guese the only way to do it is to make like a 32x1048576 texture and just wrap it along 1 direction

JustHanging
01-27-2003, 12:22 AM
Hi,

I don't think it's possible to tile just a part of the texture. Or actually it is with dependent reads, but I'm afraid the slowdown caused by dependent reads cancels out the advantage of a single texture. What do you need this for? Perhaps there are other ways to achieve what you're trying to do.

-Ilkka

01-28-2003, 01:54 PM
Well I have no problem with having all textures i want to tile,wrap,etc. as separate textures. I was just wondering because a commong thing I see is to combine multiple smaller textures into a larger one to decrease texture state changes. But when you do this you lose the ability to tile any of those textures since they don't occupy the full image. Would have been nice to be able to find a way to take advantage of combining multiple images into one larger texture, yet still retain the ability to tile, wrap, mirror etc.

yakuza
01-28-2003, 02:03 PM
How about using glCopyTexSubImage to create a new texture out of the larger texture? This would allow you to tile, mirror, etc.

Edit: Granted, this takes away the benefit of having many textures packed into one large image file...

[This message has been edited by yakuza (edited 01-28-2003).]