#### Archived

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

# Re: Lesson 10

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

## Recommended Posts

I''m trying to get my head around lesson 10. this is regarding the STRUCTURE of the data we read in. I understand that essentially to read in the data, we must first know how many TRIANGLES we have in the picture. I''m assuming all model making programs always declare how many polygons, trigangles, whatever form the MODEL. Now each POINT contains 5 pieces of info: x, y, z, u, v x, y, z are easy to understand, they are the 3D position for that point. but u and v? i don''t understand how that comes into play. I know it''s used for textures, but HOW is it devised and what part does it play in the setting up of a world? I hope this makes sence. -PK- -PK-

##### Share on other sites
u and v define the 2D texture coordinate of that 3D vertex on your 2D texture. Does that make sense? It sounds slightly confusing I guess. These don''t make a whit of a difference if you''re not doing texture mapping.

Morgan

##### Share on other sites
Um. Yes. That i knew. But that is my question!

I know they represent the Co-Ordinates for a texture map, but what i don''t understand is how it can be 2D on a 3D point, and why it''s needed.

Can this please be explained? My closest guess is so that it is texture mapped correctly (ie. not upside, for example).

But i need a proper explanation please =)

-PK-

##### Share on other sites
Imagine that you have to apply a texture on a triangle.

the code to render the triangle is

glBegin(GLTRIANGLES;
glVertex3f(-1.0f, 1.0f, 0.0f);
glVertex3f(-1.0f,-1.0f, 0.0f);
glVertex3f( 1.0f, -1.0f, 0.0f);
glEnd();

This is an untextured triangle like this

/\
/ \
/ \
/ \
/ \
/ \
/______\

Now a textured triangle

glBegin(GLTRIANGLES;
glTexCoord2f(0.0f, 1.0f); //top left of the texture
glVertex3f(-1.0f, 1.0f, 0.0f);
glTexCoord2f(0.0f, 0.0f); //bottom left of the texture
glVertex3f(-1.0f,-1.0f, 0.0f);
glTexCoord2f(1.0f, 0.0f); //bottom right of the texture
glVertex3f( 1.0f, -1.0f, 0.0f);
glEnd();

The triangles is geometrically the same but now it is texture mapped with a texture image that you have to load previously in your code.

Does it make sense to you ?

##### Share on other sites
Sorry, forget my poor try to represent the trianle with ascii character, all the rest is right.

Does anyone know how to include links, and spaces in this shitty message board posts ?

##### Share on other sites
You simply type standard HTML code.
Links: (a href="http://url")My Link(/a) where ( and ) are less than and greater than symbols, while you can represent spaces with & nbsp ; (whithout the spaces), I think.

(Test NeHe''s                 site

EL

##### Share on other sites
aha ic.. it cleared a lot!

Edited by - Blizz on June 26, 2000 12:39:09 PM

1. 1
2. 2
3. 3
Rutin
19
4. 4
5. 5
JoeJ
12

• 14
• 22
• 9
• 31
• 17
• ### Forum Statistics

• Total Topics
632617
• Total Posts
3007471
• ### Who's Online (See full list)

There are no registered users currently online

×