Advertisement

Lesson 10...Again

Started by November 01, 2004 05:16 PM
3 comments, last by kola 20 years ago
You can all hit me till the cows come home on this one but... In lesson 10 I'm not sure if I got the right idea about whats going on. Are we drawing 2 triangles so they make a square, and drawing half the texture on each sqaure? A___B |\....|<----Map a the whole texture to these A and B? |..\..| |__.\| B....A <----Same down here? Then stretch it however long you need it, while telling it how many times you want it to repeat itself (0.0f, 6.0f) for say 6 squares in a hall way? Feel free to tell me if this made no sense... P.S. The dots are all just fillers. [Edited by - Hola on November 1, 2004 6:29:52 PM]
The Best Is Yet To Come
Hola,

yes, we are only drawing triangles in lesson 10.

As for texturing:

Each vertex has not only a position coord (x,y,z), but a texture coord (u,v). These are all set up before we send the triangles to the render function so that you dont have to worry about which texture coord to use.

As for your picture, the texture is probably spread across the entire quad. So think of it this way:

A---B Texture Coord for Vertex A: (0,0)
|\ | Texture Coord for Vertex B: (1,0)
| \ | Texture Coord for Vertex C: (0,1)
| \| Texture Coord for Vertex D: (1,1)
C---D

This of course would all be assigned by your map editor if you are using one, or by hand if you are trying to manually write a world file that will be read in.

Hope this makes sense, post a reply if not...
Hard work USUALLY pays off in the future, but laziness ALWAYS pays off right now.
Advertisement
I also had the same problem as Hola posted. I just wonder how to generate the world.txt file? I have found some samples use .raw file for their terrain or "world map". How do you create .raw files?

Thanks a lot for the help!
Kola,

a .raw file is merely a file where all you have is data. There is no header or encryption on it. .raw files are often used for heightmaps that way you dont have to worry about parsing through any header information just to get to the pixel data. You just have straight up 8 bits per color, per pixel, to read in. As for creating a .raw file for this purpose almost any decent image editor can do it. Most that I have seen just have you choose .raw file from the dropdown list in the SaveAs menu.

Concerning world data files:

In general you are not going to be using a world.txt file that you hand write. Especially if you want to be very detailed with it. Rather you are going to use a program such as milkshape, worldcraft, radiant, etc to build your individual maps for you and then you will write your program to be able to parse through and read in those particular file formats. For instance, check out the Quake 3 BSP file tutorials at GameTutorials.com. You will get a better idea of what I am talking about after reading them. I think there are like 5 of them. Keep in mind though that several of the editors are for personal use only so using them to create levels for a commercial game is illegal unless you buy a liscense from ID, Valve, etc...

Hope this helps.
Hard work USUALLY pays off in the future, but laziness ALWAYS pays off right now.
Thanks a lot bu11frog! Is there any tutorial that teaches you how to create a .raw file?

This topic is closed to new replies.

Advertisement