Archived

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

Fill wall with a texture

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

Recommended Posts

Hello I am heaving a little problem on glTexCoord2f: I made a wall with vertex. I have all the sizes of this wall, like Width, height, etc. i want to fill my wall with a texture that i''ve alread loaded. How do i have to calculate the glTexCoord2f to fill my wall with the texture ? (not to strech) Thank you

Share on other sites
do you have the texture mapped to the wall already and it is stretched?

if so you probly have code like this

glTexCoord2f(1.0f, 0.0f);

try this out:
for every 1.0f change to 2.0f or 3.0f

Share on other sites
Thats it. i dont want to calculate how many times my image is going to multiplicate. I want something to do it automaticly

Share on other sites
How about the x coord beeing width?
That should be OK if your wall looks ok at 1 by 1 size,
but otherwise just make the coord: width * (value that you decided upon in previous post).

Share on other sites
Alread did it. Width_of_the_image * width_of_the_wall.

But something wrong happens. Cause the size of the image can be 128 pixels. But if i put a size of 128 in the wall, the wall will be very very bigger than the image. Theyer sizes are in different method. Did u understand ?

Share on other sites
That don''t sound right...

First: are you sure you are using the width of the wall (not, for instance, the highest x coord)?

I think my last explanation was a bit s***y..

If your wall textured wall looks ok when the wall is rendered by:

glTexCoord2f(0,0); glVertex3f(0,0);
glTexCoord2f(0,1); glVertex3f(0,1);
glTexCoord2f(1,1); glVertex3f(1,1);
glTexCoord2f(1,0); glVertex3f(1,0); //(not checked )

then all you need to do is to render your wall using:

glTexCoord2f(0,0); glVertex3f(*,*);
glTexCoord2f(0,hite); glVertex3f(*,*);
glTexCoord2f(width,hite); glVertex3f(*,*);
glTexCoord2f(width,0); glVertex3f(*,*); //(not checked )

This will make the texture the same streched-ness on both walls.

If not then...

(maybe later)

http://www.fana.co.uk/

Share on other sites
The Width is the Width of the Wall or of the texture ?

Wall

Share on other sites
No. Didnt worked. The image got repeated like a houndred times.
Ps.: The image is 128 x 128.

Anything else that i can try ?

Share on other sites
So, when the wall is rendering from 1,1 to 3,3, what would your system say the width is?

I would say that width = 2 and hite is 2.

This _will_ work with previos system...

1. 1
2. 2
Rutin
21
3. 3
A4L
15
4. 4
5. 5
khawk
14

• 13
• 26
• 10
• 11
• 44
• Forum Statistics

• Total Topics
633741
• Total Posts
3013622
×