Hello,
So I tried to modify the cube example in Qt by transforming it into a parallelepiped and also by adding a coordinate system.
This is the function that draws the frame:
void MainWidget::draw_frame()
{
glLineWidth(8.0f);
glBegin(GL_LINES);
//X_axis
glColor3f(1.0, 0.0, 0.0);
glVertex3f(0.0, 0.0, 0.0);
glVertex3f(4.0, 0.0, 0.0);
// arrow
glVertex3f(4.0, 0.0f, 0.0f);
glVertex3f(3.75, 0.25f, 0.0f);
glVertex3f(4.0, 0.0f, 0.0f);
glVertex3f(3.75, -0.25f, 0.0f);
//Y_axis
glColor3f (0.0, 1.0, 0.0);
glVertex3f(0.0, 0.0, 0.0);
glVertex3f(0.0, 4.0, 0.0);
// arrow
glVertex3f(0.0, 4.0f, 0.0f);
glVertex3f(0.25, 3.75f, 0.0f);
glVertex3f(0.0, 4.0f, 0.0f);
glVertex3f(-0.25, 3.75f, 0.0f);
//Z_axis
glColor3f (0.0, 0.0, 1.0);
glVertex3f(0.0, 0.0, 0.0);
glVertex3f(0.0, 0.0, 4.0);
// arrow
glVertex3f(0.0, 0.0f ,4.0f );
glVertex3f(0.0, 0.25f ,3.75f );
glVertex3f(0.0, 0.0f ,4.0f );
glVertex3f(0.0, -0.25f ,3.75f );
glEnd();
}
Each axis is supposed to have a specific color ( for example x: red, y: green, z:blue).
However the axes have the same color as the object texture.
glColor3f
doesn’t seem to work in this case.
Any idea on how to fix this or why does this happen ?