12-12-2002, 09:12 PM
I noticed when using Mipmapped textures,that some bitmaps appeared skewed and distorted.
through experimentation i found that depending on the aspect ratio of the bitmaps, different texture co-ordinates were required to keep the bitmap from skewing
i have set my format so that the verticies are given to openGL in a clockwise manner
sample verticies (z =0)
A-------B
| |
| |
| |
D-------C
Tex co-ords
A : 0,1
B : 1,1
C : 1,0
D : 0,0
I used a square bitmap and placed it on the square ABCD and all was good. the texture fit on perfectly. The top left of the bitmap was aligned to A, the top right to B, and so on.
when i used a rectangular bitmap (ratio x:y 2:1), that was NOT the case. The texture was all skewed.
i was able to (by trial and error) make the texture fit on to the quad properly y changing the texture co-ords.
how do i calculate the correct texture co-ords given the X and Y of the bitmap?
Problem 2:
Using the Square bitmap as a texture, i made ABCD into a Trapezoid. The Result (http://www.geocities.com/mycae/trapez.jpg)
you can see a line (Vertex A -> vertex C) where the 2 different methods of fixing the texture are visble. How do i make it so that the texture is streched without the obvious discontiniuty across the whole poly (where it appears to be divided into triangles...), so that there isnt that line.
All suggestions are appreciated.
through experimentation i found that depending on the aspect ratio of the bitmaps, different texture co-ordinates were required to keep the bitmap from skewing
i have set my format so that the verticies are given to openGL in a clockwise manner
sample verticies (z =0)
A-------B
| |
| |
| |
D-------C
Tex co-ords
A : 0,1
B : 1,1
C : 1,0
D : 0,0
I used a square bitmap and placed it on the square ABCD and all was good. the texture fit on perfectly. The top left of the bitmap was aligned to A, the top right to B, and so on.
when i used a rectangular bitmap (ratio x:y 2:1), that was NOT the case. The texture was all skewed.
i was able to (by trial and error) make the texture fit on to the quad properly y changing the texture co-ords.
how do i calculate the correct texture co-ords given the X and Y of the bitmap?
Problem 2:
Using the Square bitmap as a texture, i made ABCD into a Trapezoid. The Result (http://www.geocities.com/mycae/trapez.jpg)
you can see a line (Vertex A -> vertex C) where the 2 different methods of fixing the texture are visble. How do i make it so that the texture is streched without the obvious discontiniuty across the whole poly (where it appears to be divided into triangles...), so that there isnt that line.
All suggestions are appreciated.