Rendering a model in openGL
<p>I'm trying to render this model in openGL:</p>

<p><a href="http://i.stack.imgur.com/lf370.png" rel="nofollow">model in image viewer</a></p>

<p>this is my attempt so far:</p>

<p><a href="http://i.stack.imgur.com/QYvTz.png" rel="nofollow">model rendered by my code</a></p>

<p>I only gave it the verticies so far, no normals or faces. I'm wondering why it doesn't look full like the first one. Is it because of lack of normals? I'm pretty sure I got the number of verticies/triangles right but I'm not sure if I've made mistakes. What is the next step to fully render the model like the first image? </p>

<p>buffer creation:</p>

<pre><code>    //Vertex buffer
GLuint vertexbuffer;
glGenBuffers(1, &amp;vertexbuffer);
glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
glBufferData(GL_ARRAY_BUFFER, sizeof(g_vertex_buffer_data), g_vertex_buffer_data, GL_STATIC_DRAW);

//color buffer
GLuint colorbuffer;
glGenBuffers(1, &amp;colorbuffer);
glBindBuffer(GL_ARRAY_BUFFER, colorbuffer);
glBufferData(GL_ARRAY_BUFFER, sizeof(g_color_buffer_data), g_color_buffer_data, GL_STATIC_DRAW);

//create shaders and attach them to a program object
GLuint program = rigShadersToProgram();

GLuint matrixID = glGetUniformLocation(program, "MVP");
</code></pre>

<p>rendering loop:</p>

<pre><code>// Rendering loop   
while (!glfwWindowShouldClose(window))
{
    //clear the screen
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    ////////////////////////////matrix operations/////////////////////////////////////////

    //projection matrix 45 degree FoV, 4:3 ratio, display range 0.1 - 100
    glm::mat4 projection = glm::perspective(99.0f, 4.0f/3.0f, 0.1f, 100.0f);

    //camera matrix
    glm::mat4 view = glm::lookAt(
                    glm::vec3(2, 1, -1), //camera is at (2,1,-1)
                    glm::vec3(0, 0 , 0), //looks at origin
                    glm::vec3(0,1, 0)  //head is up
                    );

    //model matrix identity matrix
    glm::mat4 model = glm::mat4(1.0f);

    //rotate
    model = glm::rotate(model, e, glm::vec3(1,2,3));


    //model-view-projection
    glm::mat4 MVP   = projection * view * model;    

    //////////////////////////////////////////////////////////////////////////////////////

    //use the compiled shaders
    glUseProgram(program);
    //send transformation matrix to currently bound shader 
    glUniformMatrix4fv(matrixID, 1, GL_FALSE, &amp;MVP[0][0]);

    glEnableVertexAttribArray(0);
    glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);

    //vertex buffer
    glVertexAttribPointer(
        0,          //index 
        3,          //size
        GL_FLOAT,   //type
        GL_FALSE,   //normalized?
        0,          //stride
        0           //array buffer offset
    );

    glEnableVertexAttribArray(1);
    glBindBuffer(GL_ARRAY_BUFFER, colorbuffer);

    //color buffer
    glVertexAttribPointer(
        1,          //index 
        3,          //size
        GL_FLOAT,   //type
        GL_FALSE,   //normalized?
        0,          //stride
        0           //array buffer offset
    );

    //draw triangle
    glDrawArrays(GL_TRIANGLES, 0, 12722*3); 

    std::cout &lt;&lt; glfwGetTime() &lt;&lt; "\n";

    glDisableVertexAttribArray(0);
    glDisableVertexAttribArray(1);

    glfwSwapBuffers(window);
    glfwPollEvents();
</code></pre>

<p>the model data is stored in an array:</p>

<pre><code> static const GLfloat g_vertex_buffer_data[] = {

-1.557376f, 0.094970f, 0.171995f, 
-1.565967f, 0.098142f, 0.171995f, 
-1.557376f, 0.094970f, -0.048469f, 
-1.565967f, 0.098142f, -0.048469f, 
-1.532660f, 0.162907f, -0.048469f, 
-1.541251f, 0.166079f, -0.048469f, 
-1.444236f, 0.405840f, 0.171996f, 
-1.452827f, 0.409013f, 0.171996f, 
-1.463533f, 0.352575f, 0.171995f, 
-1.472257f, 0.355747f, 0.171995f, 
-1.528166f, 0.175331f, 0.011009f, 
-1.536757f, 0.178371f, 0.011009f, 
-1.538475f, 0.146781f, 0.025019f,  ... etc
</code></pre>

<p>vertex shader:</p>

<pre><code>#version 430 core                                                 

layout(location =0) in vec3 vpos;
layout(location =1) in vec3 vertexColor;

out vec3 fragmentColor;
uniform mat4 MVP;

void main(void)                                                     
{                 
    //output position of the vertex in clip space MVP*position
    gl_Position = MVP * vec4(vpos,1);
    fragmentColor = vertexColor;
};      
</code></pre>

<p>fragment shader:</p>

<pre><code>#version 430 core                             

in vec3 fragmentColor;

out vec3 color;                               

void main()                               
{                                             
    color = fragmentColor;         
};                  
</code></pre>