Once you have your rough size data then you would create cuboids (blocks) to make up the buldings, I'm not sure what average buildings look like in Malaysia so I'm going to use an example of a typical house from here in Scotland (very boxy). First you would use some vertices to define the shape of the box, for example:
glBegin(GL_QUADS); // front face glVertex3f(-10.0f, -10.0f, 10.0f); glVertex3f( 10.0f, -10.0f, 10.0f); glVertex3f( 10.0f, 10.0f, 10.0f); glVertex3f(-10.0f, 10.0f, 10.0f); // left face glVertex3f(-10.0f, -10.0f, -10.0f); glVertex3f(-10.0f, -10.0f, 10.0f); glVertex3f(-10.0f, 10.0f, 10.0f); glVertex3f(-10.0f, 10.0f, -10.0f); // right face glVertex3f( 10.0f, -10.0f, 10.0f); glVertex3f( 10.0f, -10.0f, -10.0f); glVertex3f( 10.0f, 10.0f, -10.0f); glVertex3f( 10.0f, 10.0f, 10.0f); // back face glVertex3f( 10.0f, -10.0f, -10.0f); glVertex3f(-10.0f, -10.0f, -10.0f); glVertex3f(-10.0f, 10.0f, -10.0f); glVertex3f( 10.0f, 10.0f, -10.0f); // top face glVertex3f(-10.0f, 10.0f, 10.0f); glVertex3f( 10.0f, 10.0f, 10.0f); glVertex3f( 10.0f, 10.0f, -10.0f); glVertex3f(-10.0f, 10.0f, -10.0f); // bottom face glVertex3f( 10.0f, -10.0f, 10.0f); glVertex3f( 10.0f, -10.0f, -10.0f); glVertex3f(-10.0f, -10.0f, -10.0f); glVertex3f(-10.0f, -10.0f, 10.0f);glEnd();
Now this will define you a box that looks something like this (I've overlayed triangles so don't worry about that):
Now that you have your box you would then go and take some pictures of the building it represents from the sides and so on, trying to get as 'face on' (square to) as you can. Now it's snowing and miserable outside my house at the moment so I've drawn a picture of the front of a house instead of taking a picture, excuse my poor artistic skills:
Now you need to apply this image to your box for your building. To do this you use texture co-ordinates, I explained them to someone else earlier so I will just point you towards the thread for that information, clicky. So let's put the texture on the front face only, just to demonstrate the effect:
glBegin(GL_QUADS); // enable texturing so that we can see our texture glEnable(GL_TEXTURE_2D); // now bind the texture id (I assume you know how to do this from your other thread) glBindTexture(GL_TEXTURE_2D, an_example_id_for_your_texture); // front face glTexCoord2f(0.0f, 0.0f); glVertex3f(-10.0f, -10.0f, 10.0f); glTexCoord2f(1.0f, 0.0f); glVertex3f( 10.0f, -10.0f, 10.0f); glTexCoord2f(1.0f, 1.0f); glVertex3f( 10.0f, 10.0f, 10.0f); glTexCoord2f(0.0f, 1.0f); glVertex3f(-10.0f, 10.0f, 10.0f); // now we disable texturing as we only have the front face's texture so far glDisable(GL_TEXTURE_2D); // rest of code the sameglEnd();
The building now looks like this:
As you can see, all this takes a long time, and this is just for one building! If you have a lot of buildings to do, especially if they're not rectangular in shape as well, then it's going to take you a very long time indeed. Also, if you want lights in your scene then you will need to specify normals for each point as well.
I hope this helps to clarify what I was talking about.