Archived

This topic is now archived and is closed to further replies.

Mulligan

Texture Coordinates

Recommended Posts

Mulligan    378
Here is the situation. I have a pretty little 1x1 quad and a texture mapped onto it. Looks great. Then I move one of the verticies and the texture starts warping to fit the new irregular shape. I know that this is what it is supposed to do, but I don''t want it to. I do understand how texture coordinates work and all, but how can I keep the texture from warping? Instead of warping the texture, it simply reveals a repeating pattern of the image. Anywhoo, I hope that made sence there.

Share this post


Link to post
Share on other sites
Omaha    100
Don''t apply the same texture coordinates to it. Change the texture coordinates similar to how you change the vertex coordinates.

What API are you using; that''s kind of relevent.

Share this post


Link to post
Share on other sites
eldee    122
er.. in opengl you dont move texture coordinates with verts...
dunno about d3d.
ie)

glBegin(GL_QUADS);
glTexCoord2f(0.0f, 0.0f);
glVertex3f(0.0f, 0.0f);

glTexCoord2f(1.0f, 0.0f);
glVertex3f(5.0f, 0.0f);

glTexCoord2f(1.0f, -1.0f);
glVertex3f(5.0f, 5.0f);

glTexCoord2f(0.0f, -1.0f);
glVertex3f(0.0f, 5.0f);
glEnd();


-eldee
;another space monkey;
[ Forced Evolution Studios ]


::evolve::

Share this post


Link to post
Share on other sites
Marius    100
call these before mapping the thexture
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);



MCO

Share this post


Link to post
Share on other sites
Mulligan    378
This looks like what I need, but I can''t get it to work. Anything special I should know? The documentation on it does not shead too much light on it.

Share this post


Link to post
Share on other sites