A follow up question to the QtOpenGLWidget drawing triangle
I want to draw a triangle and some lines, I wrote this code (with the wonderful help of people in the stackoverflow community) it draws triangle and lines. However, when I want to draw triangle and lines at the same time, I dont see the lines.
GLfloat vertices[] = { 0.0f, 0.707f, 0.5f, -0.5f, -0.5f, 0.5f, 0.5f, -0.5f, 0.5f };
GLfloat colors[] = { 1.f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f};
shader->setAttributeArray(posAttribute, vertices, 3, 0);
shader->setAttributeArray(colAttribute, colors, 3, 0);
glEnableVertexAttribArray(posAttribute);
glEnableVertexAttribArray(colAttribute);
glDrawArrays(GL_TRIANGLES, 0, 3);
glDisableVertexAttribArray(posAttribute);
glDisableVertexAttribArray(colAttribute);
GLfloat lvertices[] = { 0.907f, 0.907f, 0.5f, -0.957f, -0.957f, 0.5f };
GLfloat lcolors[] = { 1.0f, 0.0f, 0.0f, 1.0f, .0f , 0.0f};
shader->setAttributeArray(posAttribute, lvertices, 3, 0);
shader->setAttributeArray(colAttribute, lcolors, 3, 0);
//glLineWidth(.03f);
glDrawArrays(GL_LINE_STRIP, 0, 6);
glDisableVertexAttribArray(posAttribute);
glDisableVertexAttribArray(colAttribute);
What am I doing wrong ?