[gameprogrammer] issues with Calculating texture coordinates
- From: "Gautam Narain" <gautam_n_@xxxxxxxxxxx>
- To: gameprogrammer@xxxxxxxxxxxxx
- Date: Thu, 01 Jun 2006 10:11:44 +0530
Hi,
I am trying to figure out how to calculate texture coordinates and was
looking into some google sites. I also went through Bob's Texture mapping
information in gameprogrammer.org page and the PCGPE article. However I
still have some doubts :-
Firstly it says to have view space coordinates - I am getting the windows
screen coordinates
using the gluProject function OpenGL. Then it says to calculate the P, M, N
vectors(i.e. the vertex in the texture space) and then to calculate the 9
magic numbers.
From what I read from the 2 articles - if I have 3 vectors v1, v2 and v3
then
P = v1 ;
M = v2 - P;
N = P - v3;
Now after I calculate the 9 magic numbers and then I calculate the fx and
fy(framebuffer vectors) which is the screen space or view space vector v1 ->
v1.x / v1.z and v1.y / v1.z.
Using these 9 magic numbers and the frame buffer vector we calculate the
values of U and V right and that is the index into the texture to use ?
However this does not seem to work. I have a window coordinate as
<320.000000, 240.000000, 0.900901> so if I divide by 0.9 it will give me a
value around 355 and in turn the U and V will be a large value.
Is my understanding of view space correct in assuming that its screen
coordinates or window coordinates ? And if so then what exactly am I
missing.
Also lastly to calculate the UV for each vertex for a triangle the magic
numbers needs to be computed once only right and the different fx and fy
values give the different UV coordinates ?
Thanks
Gautam
---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html
- Follow-Ups:
- [gameprogrammer] Re: issues with Calculating texture coordinates
- From: Scott Harper
Other related posts:
- » [gameprogrammer] issues with Calculating texture coordinates
- » [gameprogrammer] Re: issues with Calculating texture coordinates
- » [gameprogrammer] Re: issues with Calculating texture coordinates
- » [gameprogrammer] Re: issues with Calculating texture coordinates
- » [gameprogrammer] Re: issues with Calculating texture coordinates
- » [gameprogrammer] Re: issues with Calculating texture coordinates
- » [gameprogrammer] Re: issues with Calculating texture coordinates
- » [gameprogrammer] Re: issues with Calculating texture coordinates
--------------------- To unsubscribe go to http://gameprogrammer.com/mailinglist.html
- [gameprogrammer] Re: issues with Calculating texture coordinates
- From: Scott Harper