how to create house - which shape

Hello,
for my final work I have to create a 3D house - 3D model with textures. Something like this
http://appliedarts.net/blog/wp-content/uploads/2016/08/R019-OPEN-GL-RENDERING-Rear-Large.jpg

I’ve read a few articles how to create 3D model, but I still don’t know which shape use to as the basic shape for every part of the house?

Should I use triangles, rectangles or cubes?

If I use triangles it will be hundreds or thousands triangles?

Which is the best way to do this 3D model?

thanks

[QUOTE=Leboww;1291459]Hello,
for my final work I have to create a 3D house - 3D model with textures. Something like this
http://appliedarts.net/blog/wp-content/uploads/2016/08/R019-OPEN-GL-RENDERING-Rear-Large.jpg

I’ve read a few articles how to create 3D model, but I still don’t know which shape use to as the basic shape for every part of the house?

Should I use triangles, rectangles or cubes?

If I use triangles it will be hundreds or thousands triangles?

Which is the best way to do this 3D model?

thanks[/QUOTE]

I’m not expert in the OpenGL, but I had readed about making 3d models in special programms (like: maya 3D, blender, 3ds max),
and then load its from file (exists c/c++ libraries for import 3d models)

What kind of class is this project for?

Should I use triangles, rectangles or cubes?

Triangles are ideal for what you want to do. More specifically - triangle strips.

If I use triangles it will be hundreds or thousands triangles?

That’s not the case. Actually, all the primatives you mentioned above are made of triangles… except a triangle. :smiley:
A quad or rectangle is made up of two triangles. A cube - 2 triangles each side - 12.

For starters if you need a good guide, (there are many out there, but…) I like these two -
Texturing:
https://learnopengl.com/Getting-started/Textures
https://open.gl/textures

Build a house (at least one side):
https://learnopengl.com/Advanced-OpenGL/Geometry-Shader

Running through these tutorials, you will learn how to create and use shaders, including the geometry shader - which you’ll need.

Next, you will need to have a means of knowing where your vertices for building your house are positioned. I can think of a few ways, but since I haven’t started to implement those, we can take the easy way out.
I threw together a simple “house”, if it can be called such (it’s just for the purpose of demonstration), and retrieved the vertex coordinates.
To do this, all you need is a 3d modeler - Blender, Wings, etc. (I used Gmax). Build your model. Export it to an .obj file. Open the file in Notepad, and copy the vertex points to selective text files (remove the letters). So for example :
In a folder named “house” (actually, you can try these. I haven’t tested them)
chimney.txt
56.7521 4.78635 58.8034
73.1624 4.78635 58.8034
56.7521 17.094 58.8034
73.1624 17.094 58.8034
56.7521 4.78635 52.1282
73.1624 4.78635 52.1282
73.1624 17.094 44.7436
56.7521 17.094 44.7436

houseSiding1.txt
75.0 -25.0 0.0
75.0 25.0 0.0
75.0 -25.0 40.0
75.0 25.0 40.0
75.0 1.90735 55.0

houseSiding2.txt
-75.0 -25.0 0.0
-75.0 25.0 0.0
-75.0 -25.0 40.0
-75.0 25.0 40.0
-75.0 3.8147 55.0

houseSiding3.txt
-75.0 25.0 0.0
75.0 25.0 0.0
-75.0 25.0 40.0
75.0 25.0 40.0
-9.57265 25.0 1.36752
7.52137 25.0 1.36752
7.52137 25.0 31.453
-9.57265 25.0 31.453
-58.1197 25.0 12.3077
-40.3419 25.0 12.3077
-40.3419 25.0 19.5356
-40.3419 25.0 32.1368
-58.1197 25.0 32.1368
-58.1197 25.0 30.0328

houseSiding4.txt
-75.0 -25.0 0.0
75.0 -25.0 0.0
-75.0 -25.0 40.0
75.0 -25.0 40.0

roofA.txt
-80.0 -0.0343582 56.2923
80.0 -0.0343566 56.2923
-80.0 33.17 37.1412
80.0 33.17 37.1412

roofB.txt
-80.0 0.0343636 56.2923
80.0 0.034348 56.2923
-80.0 -33.1699 37.1412
80.0 -33.17 37.1412

Next, you need a way to read these files into float arrays, so that you can input them into your geometry shader via code, otherwise you have to manually input them by hand, which is a lot of work to build the house in your image. I’m sure you’ll have fun creating code to do all this. Let me know if you want a push start.

Basically though, you just need a way to plot out your vertices, and then write a code that inputs them in your geometry shader.

All the best.

I made a simple house in Blender, textured it in GIMP, exported it to .obj format, imported it to a program written in Python/GLFW/OpenGL 3.3

See the tutorial: Modern OpenGL programming in Python

You can rewrite the code to any language because OpenGL programs look the same in any languages.

Source Code: house.zip