View Full Version : Quad Strip Textures
01-14-2006, 04:37 PM
I am very new to Opengl programing so please forgive me for what I don't know (yet). I have a quad strip and a texture. I can use the texture with single quads and the texture is fine - but when I try to apply it to the strip it gets stretched out across the entire strip instead of 1 texture tile in each section of the quad strip. Any help would be greatly appreciated.
01-16-2006, 07:27 AM
You need to increment the texture coordinates as you increment the vertex positions, but really you should read the Red Book on texturing. Specifically Chapter 9, here:
01-17-2006, 08:50 PM
After an offline message I'll offer some additional explanation.
Think of texture as a rubber sheet. You can stretch this rubber sheet over each triangle using a pin at each vertex. That per vertex pin can be stuck anywhere on the texture map (rubber sheet). The coordinates 0.0 to 1.0 in s and t specify for each vertex where the pin is on the texture map and therefore what portion of the image is stretched over each triangle.
Using this simple analogy it should be easy to visualize how texture coordinates work.
You can reuse the same rubber sheet portions elsewhere on other triangles multiple times there are no restrictions.
The rubber sheet can tile infinitely in all directions so specifying a value less than 0.0 or greater than 1.0 allows multiple tiled images on the infinite rubber sheet to be applied to a triangle. This tiling depends on the texture wrap mode.
01-18-2006, 06:30 AM
Once again many thanks to your reply. I believe I understand everything you mentioned and have been using those techniques. What is happening is this.
I have single quads. Each drawn separately. I texture them with a piece of a texture. The texture image has 64 different types of textures in 1 image. I am using .01,.01; .115,.01 ;.115 .115; .01,.115 for texture coordinates and the quads look great. If I split the quads into triangles everything still looks fine. But when I start using strips, whether they are quads or triangles those same texture coordinates do not work. The texture is greatly magnified as if to be a much smaller piece of the texture that is specified. Also, if I increment the texture coords as you said it does get rid of the magnification but instead of the "piece" of the texture I specify - the entire texture image is used. It also seems to repeat in 1 direction only which is really confusing me because I have both s and t set to repeat. I know you said that you can reuse the same texture area over and over and that works fine with single quads or triangles - but is this not possible with a strip??
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.