This article is almost similar to my previous tutoirals series. In previous article we draw only triangle but here we are drawing other shapes.
Download
All the code in this series of articles is available from github:
https://github.com/smokindinesh/Modern-OpenGL-Series You can download a zip of all the files from that page, or you can clone the repository if you are familiar with git.
Vertex data for drawing is given below:
// Put the 18 triangle verticies into the VBO
GLfloat vertexData[] = {
// X Y Z
//Pentagon
0.25f, 0.25f, 1.0f,
0.75f, 0.25f, 1.0f,
0.25f, 0.5f, 1.0f,
0.25f, 0.5f, 1.0f,
0.75f, 0.25f, 1.0f,
0.75f, 0.5f, 1.0f,
0.25f, 0.5f, 1.0f,
0.75f, 0.5f, 1.0f,
0.5f, .75f, 1.0f,
//Triangle
-0.25f, 0.25f, 1.0f,
-0.5f, 0.75f, 1.0f,
-0.75f, 0.25f, 1.0f,
//Trapezoid
-0.2f, -0.25f, 1.0f,
-0.35f, -0.75f, 1.0f,
0.35f, -0.75f, 1.0f,
0.2f, -0.25f, 1.0f,
-0.2f, -0.25f, 1.0f,
0.35f, -0.75f, 1.0f,
};