hi!.
I'm using Qt 4.6 in GNU/Linux. i'm working with QGLWidget with kind of easiness but i've a problem when i want to change the color of the Lines.
I've tried all the combinations that i could think.
i've put the glColor after and befor de glBegin, use the qglColor, and glColor3f (and others glColors functions). But always it's a random color between blue and green (never red (i don't know why)).
What am i missing?
Code:
glBegin(GL_LINES); glColor3f(1.0f,0.0,0.0); glVertex2f(50,1); glVertex2f(120,1); glEnd() ;
this very basic code doesn't work
Code:
void Plot::paintGL() { glBegin(GL_LINES); glColor3f(1.0f,0.0,0.0); glVertex2f(50,1); glVertex2f(120,1); glEnd(); } void Plot::initializeGL() { // Also i've tried a lot of combinations here. GL_FLAT and others. glClearColor(1.0, 1.0 , 1.0, 0.0); glLoadIdentity(); glTranslatef(0,0.0,0); glDisable(GL_TEXTURE_2D); glDisable(GL_LIGHTING); glShadeModel(GL_SMOOTH); } void Plot::resizeGL(int w, int h) { glViewport( 0, 0, (GLint)w, (GLint)h ); glMatrixMode( GL_PROJECTION ); glLoadIdentity(); glOrtho( 0, 800, yMin, yMax, -5.0, 1.0 ); glMatrixMode( GL_MODELVIEW ); }