A 3D engine made completely from scratch
using only OpenGL
It's re-starting cuz I moved from SDL to OpenGL
Those meshes were made manually, so this bottle
is more amazing than the whole code
I changed the normal projection matrix for a vector because
it seems to be faster and cleaner (maybe idk)
Since I'm using .obj
files now, I'll let the bottle live here
Mesh bottle = {
// Bottom
-0.5, -3, -1, 0, 0, 0, /* */ +0.5, -3, -1, 0, 0, 0, /* */ +0, -3, +0, 0, 0, 0,
+0.5, -3, -1, 0, 0, 0, /* */ +1, -3, -0.5, 0, 0, 0, /* */ +0, -3, +0, 0, 0, 0,
+1, -3, -0.5, 0, 0, 0, /* */ +1, -3, +0.5, 0, 0, 0, /* */ +0, -3, +0, 0, 0, 0,
+1, -3, +0.5, 0, 0, 0, /* */ +0.5, -3, +1, 0, 0, 0, /* */ +0, -3, +0, 0, 0, 0,
+0.5, -3, +1, 0, 0, 0, /* */ -0.5, -3, +1, 0, 0, 0, /* */ +0, -3, +0, 0, 0, 0,
-0.5, -3, +1, 0, 0, 0, /* */ -1, -3, +0.5, 0, 0, 0, /* */ +0, -3, +0, 0, 0, 0,
-1, -3, +0.5, 0, 0, 0, /* */ -1, -3, -0.5, 0, 0, 0, /* */ +0, -3, +0, 0, 0, 0,
-1, -3, -0.5, 0, 0, 0, /* */ -0.5, -3, -1, 0, 0, 0, /* */ +0, -3, +0, 0, 0, 0,
// Faces
-0.5, -3, -1, 0, 0, 0, /* */ -0.5, +1, -1, 0, 0, 0, /* */ +0.5, -3, -1, 0, 0, 0,
-0.5, +1, -1, 0, 0, 0, /* */ +0.5, +1, -1, 0, 0, 0, /* */ +0.5, -3, -1, 0, 0, 0,
+0.5, -3, -1, 0, 0, 0, /* */ +0.5, +1, -1, 0, 0, 0, /* */ +1, -3, -0.5, 0, 0, 0,
+0.5, +1, -1, 0, 0, 0, /* */ +1, +1, -0.5, 0, 0, 0, /* */ +1, -3, -0.5, 0, 0, 0,
+1, -3, -0.5, 0, 0, 0, /* */ +1, +1, -0.5, 0, 0, 0, /* */ +1, -3, +0.5, 0, 0, 0,
+1, +1, -0.5, 0, 0, 0, /* */ +1, +1, +0.5, 0, 0, 0, /* */ +1, -3, +0.5, 0, 0, 0,
+1, -3, +0.5, 0, 0, 0, /* */ +1, +1, +0.5, 0, 0, 0, /* */ +0.5, -3, +1, 0, 0, 0,
+1, +1, +0.5, 0, 0, 0, /* */ +0.5, +1, +1, 0, 0, 0, /* */ +0.5, -3, +1, 0, 0, 0,
+0.5, -3, +1, 0, 0, 0, /* */ +0.5, +1, +1, 0, 0, 0, /* */ -0.5, -3, +1, 0, 0, 0,
+0.5, +1, +1, 0, 0, 0, /* */ -0.5, +1, +1, 0, 0, 0, /* */ -0.5, -3, +1, 0, 0, 0,
-0.5, -3, +1, 0, 0, 0, /* */ -0.5, +1, +1, 0, 0, 0, /* */ -1, -3, +0.5, 0, 0, 0,
-0.5, +1, +1, 0, 0, 0, /* */ -1, +1, +0.5, 0, 0, 0, /* */ -1, -3, +0.5, 0, 0, 0,
-1, -3, +0.5, 0, 0, 0, /* */ -1, +1, +0.5, 0, 0, 0, /* */ -1, -3, -0.5, 0, 0, 0,
-1, +1, +0.5, 0, 0, 0, /* */ -1, +1, -0.5, 0, 0, 0, /* */ -1, -3, -0.5, 0, 0, 0,
-1, -3, -0.5, 0, 0, 0, /* */ -1, +1, -0.5, 0, 0, 0, /* */ -0.5, -3, -1, 0, 0, 0,
-1, +1, -0.5, 0, 0, 0, /* */ -0.5, +1, -1, 0, 0, 0, /* */ -0.5, -3, -1, 0, 0, 0,
// Curve
-0.5, +1, -1, 0, 0, 0, /* */ +0.1, 2, -0.2, 0, 0, 0, /* */ +0.5, +1, -1, 0, 0, 0,
-0.5, +1, -1, 0, 0, 0, /* */ -0.1, 2, -0.2, 0, 0, 0, /* */ +0.1, 2, -0.2, 0, 0, 0,
+0.5, +1, -1, 0, 0, 0, /* */ +0.2, 2, -0.1, 0, 0, 0, /* */ +1, +1, -0.5, 0, 0, 0,
+0.5, +1, -1, 0, 0, 0, /* */ +0.1, 2, -0.2, 0, 0, 0, /* */ +0.2, 2, -0.1, 0, 0, 0,
+1, +1, -0.5, 0, 0, 0, /* */ +0.2, 2, +0.1, 0, 0, 0, /* */ +1, +1, +0.5, 0, 0, 0,
+1, +1, -0.5, 0, 0, 0, /* */ +0.2, 2, -0.1, 0, 0, 0, /* */ +0.2, 2, +0.1, 0, 0, 0,
+1, +1, +0.5, 0, 0, 0, /* */ +0.1, 2, +0.2, 0, 0, 0, /* */ +0.5, +1, +1, 0, 0, 0,
+1, +1, +0.5, 0, 0, 0, /* */ +0.2, 2, +0.1, 0, 0, 0, /* */ +0.1, 2, +0.2, 0, 0, 0,
+0.5, +1, +1, 0, 0, 0, /* */ -0.1, 2, +0.2, 0, 0, 0, /* */ -0.5, +1, +1, 0, 0, 0,
+0.5, +1, +1, 0, 0, 0, /* */ +0.1, 2, +0.2, 0, 0, 0, /* */ -0.1, 2, +0.2, 0, 0, 0,
-0.5, +1, +1, 0, 0, 0, /* */ -0.2, 2, +0.1, 0, 0, 0, /* */ -1, +1, +0.5, 0, 0, 0,
-0.5, +1, +1, 0, 0, 0, /* */ -0.1, 2, +0.2, 0, 0, 0, /* */ -0.2, 2, +0.1, 0, 0, 0,
-1, +1, +0.5, 0, 0, 0, /* */ -0.2, 2, -0.1, 0, 0, 0, /* */ -1, +1, -0.5, 0, 0, 0,
-1, +1, +0.5, 0, 0, 0, /* */ -0.2, 2, +0.1, 0, 0, 0, /* */ -0.2, 2, -0.1, 0, 0, 0,
-1, +1, -0.5, 0, 0, 0, /* */ -0.1, 2, -0.2, 0, 0, 0, /* */ -0.5, +1, -1, 0, 0, 0,
-1, +1, -0.5, 0, 0, 0, /* */ -0.2, 2, -0.1, 0, 0, 0, /* */ -0.1, 2, -0.2, 0, 0, 0,
// Neck
-0.1, +3, -0.2, 0, 0, 0, /* */ +0.1, 2, -0.2, 0, 0, 0, /* */ -0.1, 2, -0.2, 0, 0, 0,
-0.1, +3, -0.2, 0, 0, 0, /* */ -0.1, 2, -0.2, 0, 0, 0, /* */ -0.2, +3, -0.1, 0, 0, 0,
+0.1, +3, -0.2, 0, 0, 0, /* */ +0.2, 2, -0.1, 0, 0, 0, /* */ +0.1, 2, -0.2, 0, 0, 0,
+0.1, +3, -0.2, 0, 0, 0, /* */ +0.1, 2, -0.2, 0, 0, 0, /* */ -0.1, +3, -0.2, 0, 0, 0,
+0.2, +3, -0.1, 0, 0, 0, /* */ +0.2, 2, +0.1, 0, 0, 0, /* */ +0.2, 2, -0.1, 0, 0, 0,
+0.2, +3, -0.1, 0, 0, 0, /* */ +0.2, 2, -0.1, 0, 0, 0, /* */ +0.1, +3, -0.2, 0, 0, 0,
+0.2, +3, +0.1, 0, 0, 0, /* */ +0.1, 2, +0.2, 0, 0, 0, /* */ +0.2, 2, +0.1, 0, 0, 0,
+0.2, +3, +0.1, 0, 0, 0, /* */ +0.2, 2, +0.1, 0, 0, 0, /* */ +0.2, +3, -0.1, 0, 0, 0,
+0.1, +3, +0.2, 0, 0, 0, /* */ -0.1, 2, +0.2, 0, 0, 0, /* */ +0.1, 2, +0.2, 0, 0, 0,
+0.1, +3, +0.2, 0, 0, 0, /* */ +0.1, 2, +0.2, 0, 0, 0, /* */ +0.2, +3, +0.1, 0, 0, 0,
-0.1, +3, +0.2, 0, 0, 0, /* */ -0.2, 2, +0.1, 0, 0, 0, /* */ -0.1, 2, +0.2, 0, 0, 0,
-0.1, +3, +0.2, 0, 0, 0, /* */ -0.1, 2, +0.2, 0, 0, 0, /* */ +0.1, +3, +0.2, 0, 0, 0,
-0.2, +3, +0.1, 0, 0, 0, /* */ -0.2, 2, -0.1, 0, 0, 0, /* */ -0.2, 2, +0.1, 0, 0, 0,
-0.2, +3, +0.1, 0, 0, 0, /* */ -0.2, 2, +0.1, 0, 0, 0, /* */ -0.1, +3, +0.2, 0, 0, 0,
-0.2, +3, -0.1, 0, 0, 0, /* */ -0.1, 2, -0.2, 0, 0, 0, /* */ -0.2, 2, -0.1, 0, 0, 0,
-0.2, +3, -0.1, 0, 0, 0, /* */ -0.2, 2, -0.1, 0, 0, 0, /* */ -0.2, +3, +0.1, 0, 0, 0,
// Top
-0.1, +3, -0.2, 0, 0, 0, /* */ +0, +3, +0, 0, 0, 0, /* */ +0.1, +3, -0.2, 0, 0, 0,
+0.1, +3, -0.2, 0, 0, 0, /* */ +0, +3, +0, 0, 0, 0, /* */ +0.2, +3, -0.1, 0, 0, 0,
+0.2, +3, -0.1, 0, 0, 0, /* */ +0, +3, +0, 0, 0, 0, /* */ +0.2, +3, +0.1, 0, 0, 0,
+0.2, +3, +0.1, 0, 0, 0, /* */ +0, +3, +0, 0, 0, 0, /* */ +0.1, +3, +0.2, 0, 0, 0,
+0.1, +3, +0.2, 0, 0, 0, /* */ +0, +3, +0, 0, 0, 0, /* */ -0.1, +3, +0.2, 0, 0, 0,
-0.1, +3, +0.2, 0, 0, 0, /* */ +0, +3, +0, 0, 0, 0, /* */ -0.2, +3, +0.1, 0, 0, 0,
-0.2, +3, +0.1, 0, 0, 0, /* */ +0, +3, +0, 0, 0, 0, /* */ -0.2, +3, -0.1, 0, 0, 0,
-0.2, +3, -0.1, 0, 0, 0, /* */ +0, +3, +0, 0, 0, 0, /* */ -0.1, +3, -0.2, 0, 0, 0
};