View Full Version : Building a world
I'm curious about the concept of world development.
My question is that, how can i build a world in an OpenGL app, how can i place objects in correct places relative to the world's dimensions.
Thx in advice.
11-20-2001, 06:43 AM
It all depends upon what you are trying to accomplish.
Most worlds are made my creating a floor, or ground, along the z axis. Buildings will stand erect along the x + z + Y axis.
I created a world similar to ones fond in UT, quake, Doom, etc, so if you could explain what you are looking for, I might be able to help.
Ok, what i'm really interested in, is that how can i place objects on the ground, for example: houses, like in DukeNukem 3.
How can i store their position in the world? Relative to each other, or should i have a reference point for placing object relative to it? What should i store to placing objects in their correct position? Should i have a file that describes the adjustment?
Thx for help.
11-23-2001, 04:40 AM
you must think of a whole world coordinate system.
when you create an object (floor,cubes, teapots,etc.) you move them by translating, rotating this local coord sys in relation to the world sys.
you must "move" the objects before drawing them.
see the redbook (written by the OGL-inventors), there are real good explanations of this. including some stacks, for "saving" transformations, so you can remember (glpush*) where you draw an object, go to the next position, and move back (glpop*) to your remembered position to draw another object.
further on you also must place the camera, lights, set the viewport, etc....
11-26-2001, 12:13 AM
You can use any data struture you want to store objects position. For example, some kind of grid which stores the x,y coords on the ground. Or just place your objects x,y position in an array. Then, you only have to glTranslate them and draw them.
To build a world you should also consider using algorithms such as Portal Render, Voxels... depending on the world. There are a lot of technics to manage your world geometry.
- nemesis -
Thx for your replies.
Powered by vBulletin® Version 4.2.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.