GL_LINE_STRIP always terminates at the origin
<p>I mean for the following code to draw a horizontal line across the screen. Instead, it draws the line and then draws a line that fades off towards the origin. A picture is posted below.</p>

<p>I think that the critical pieces of code are</p>

<pre><code>float vertices[] =
{
    -0.5, 0.7, 1, 1, 1,
     0.5, 0.7, 1, 1, 1
};
</code></pre>

<p>and</p>

<pre><code>glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);

while (not glfwWindowShouldClose(window))
{
    glClearColor(0,0,0,1);
    glClear(GL_COLOR_BUFFER_BIT);

    glDrawArrays(GL_LINE_STRIP, 0, sizeof(vertices)/sizeof(float));

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

<p>The full code is</p>

<pre><code># include &lt;GL/glew.h&gt;
# include &lt;GLFW/glfw3.h&gt;

const GLchar * vertex_shader_source =
"\
    # version 150 core\n\
    in vec2 position;\
    in vec3 color;\
    out vec3 Color;\
    void main() { Color = color; gl_Position = vec4(position, 0, 1); }\
";

const GLchar * fragment_shader_source =
"\
    # version 150 core\n\
    in vec3 Color;\
    out vec4 outColor;\
    void main() { outColor = vec4(Color, 1.0); }\
";

float vertices[] =
{
    -0.5, 0.7, 1, 1, 1,
     0.5, 0.7, 1, 1, 1
};

int main (int argc, char ** argv)
{
        // ---- INITIALIZE STUFF ---- //

    glfwInit();

    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
    glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
    glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
    glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
    glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);

    GLFWwindow * window = glfwCreateWindow(800, 600, "open-gl", nullptr, nullptr);
    glfwMakeContextCurrent(window);

    glewExperimental = GL_TRUE;
    glewInit();

        // ---- MAKE SHADERS ---- //

    GLuint vertex_shader = glCreateShader(GL_VERTEX_SHADER);
    glShaderSource(vertex_shader, 1, &amp;vertex_shader_source, NULL);
    glCompileShader(vertex_shader);

    GLuint fragment_shader = glCreateShader(GL_FRAGMENT_SHADER);
    glShaderSource(fragment_shader, 1, &amp;fragment_shader_source, NULL);
    glCompileShader(fragment_shader);

    GLuint shader_program = glCreateProgram();
    glAttachShader(shader_program, vertex_shader);
    glAttachShader(shader_program, fragment_shader);
    glBindFragDataLocation(shader_program, 0, "outColor");
    glLinkProgram(shader_program);

    glUseProgram(shader_program);

        // ---- MAKE VERTEX BUFFER OBJECT ---- //

    GLuint vbo;
    glGenBuffers(1, &amp;vbo);
    glBindBuffer(GL_ARRAY_BUFFER, vbo);

        // ---- MAKE VERTEX ARRAY OBJECT ---- //

    GLuint vao;
    glGenVertexArrays(1, &amp;vao);
    glBindVertexArray(vao);

    GLint posAttrib = glGetAttribLocation(shader_program, "position");
    GLint colAttrib = glGetAttribLocation(shader_program, "color");

    glEnableVertexAttribArray(posAttrib);
    glEnableVertexAttribArray(colAttrib);

    glVertexAttribPointer(posAttrib, 2, GL_FLOAT, GL_FALSE, 5*sizeof(float), 0);
    glVertexAttribPointer(colAttrib, 3, GL_FLOAT, GL_FALSE, 5*sizeof(float), (void*)(2*sizeof(float)));

        // ---- DO OTHER THINGS ---- //

    glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);

    while (not glfwWindowShouldClose(window))
    {
        glClearColor(0,0,0,1);
        glClear(GL_COLOR_BUFFER_BIT);

        glDrawArrays(GL_LINE_STRIP, 0, sizeof(vertices)/sizeof(float));

        glfwSwapBuffers(window);
        glfwPollEvents();
    }

        // ---- CLEAN UP ---- //

    glDeleteProgram(shader_program);
    glDeleteShader(vertex_shader);
    glDeleteShader(fragment_shader);
    glDeleteVertexArrays(1, &amp;vao);
    glDeleteBuffers(1, &amp;vbo);

    glfwTerminate();

    return 0;
}
</code></pre>

<p>The output is<a href="https://i.stack.imgur.com/wqYS2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wqYS2.png" alt="output"></a></p>

<p>I have no idea what the problem is; I have searched the internet, but I cannot find anyone who has had a similar problem. The best that I have found is someone who said that OpenGL implementations do not tend to do lines very well. This does not happen with GL_LINES, however.</p>

<p>I am using OpenGL 3.2 with GLFW and GLEW. I have an Acer Aspire v5-571P-6648; I do not know specifically what model of graphics card it has, but I can look for it.</p>