[gameprogrammer] Re: issues with Calculating texture coordinates
- From: "Olof Bjarnason" <olof.bjarnason@xxxxxxxxx>
- To: gameprogrammer@xxxxxxxxxxxxx
- Date: Fri, 2 Jun 2006 09:14:11 +0200
either you have your 3d-modeller (3dfx or some other program) generate
those coordinates and your model loader read them from the .3df file.
or you could use automatic texture coordinate generation in opengl
(glTexFunc). with automatic generation, you do things like "use object
space coordinates as texture coordinates" or "use view space
coordinates as texture coordinates" or more advanced "generate sphere
or cube mapping coordinates" (reflecting object).
I think you are looking for getting your 3d-model loader format to
include texture coordinate information.
are you trying to view a texture mapped model, eg. a spaceship, or
something else?
/Olof
On 6/2/06, Gautam Narain <gautam_n_@xxxxxxxxxxx> wrote:
Hi,
In the most simple case this will be alright. But I am looking at how those
values are calculated. Yes for a simple triangle its as simple as this -
just put 0,0, and 1, 1 and 0,1 etc appropriately. But lets say I had a 3d
model with 100 vertices and I wanted to calcluate the texture coordinates
then how would I do it ?
Hence I was looking at http://www.gameprogrammer.com/6-text.html and PCGPE.
Thanks
Gautam
>[gameprogrammer] Re: issues with Calculating texture coordinates
>
> * From: "Olof Bjarnason" <olof.bjarnason@xxxxxxxxx>
> * To: gameprogrammer@xxxxxxxxxxxxx
> * Date: Thu, 1 Jun 2006 15:14:03 +0200
>if you just want to stretch the texture over the triangle in the
>simplest, most basic way, just type something like
>glTexCoord2f(0,0); // (0,0) is the top-left corner of texture
>glVertex3f(0,0,-10);
>glTexCoord2f(1,0); // (1,0) is the top-right corner of texture
>glVertex3f(0,1,-10);
>glTexCoord3f(1,1); // (1,1) is the bottom-right corner of texture
>glVertex3f(1,1,-10);
>good luck
/Olof
---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html
--
--~--~---------~--~----~------------~-------~--~----~
-~----------~----~----~----~------~----~------~--~---
---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html
- References:
- [gameprogrammer] Re: issues with Calculating texture coordinates
- From: Gautam Narain
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
Hi,
In the most simple case this will be alright. But I am looking at how those values are calculated. Yes for a simple triangle its as simple as this - just put 0,0, and 1, 1 and 0,1 etc appropriately. But lets say I had a 3d model with 100 vertices and I wanted to calcluate the texture coordinates then how would I do it ?
Hence I was looking at http://www.gameprogrammer.com/6-text.html and PCGPE.
Thanks Gautam
>[gameprogrammer] Re: issues with Calculating texture coordinates > > * From: "Olof Bjarnason" <olof.bjarnason@xxxxxxxxx> > * To: gameprogrammer@xxxxxxxxxxxxx > * Date: Thu, 1 Jun 2006 15:14:03 +0200
>if you just want to stretch the texture over the triangle in the >simplest, most basic way, just type something like
>glTexCoord2f(0,0); // (0,0) is the top-left corner of texture >glVertex3f(0,0,-10);
>glTexCoord2f(1,0); // (1,0) is the top-right corner of texture >glVertex3f(0,1,-10);
>glTexCoord3f(1,1); // (1,1) is the bottom-right corner of texture >glVertex3f(1,1,-10);
>good luck
/Olof
--------------------- To unsubscribe go to http://gameprogrammer.com/mailinglist.html
--------------------- To unsubscribe go to http://gameprogrammer.com/mailinglist.html
- [gameprogrammer] Re: issues with Calculating texture coordinates
- From: Gautam Narain