Hi I don't undesrtand a thing: I draw with OpenGl a line and I put it in paintGL (and it is OK):
//initializeGL()
.....
glEnable(GL_BLEND);
glEnable(GL_LINE_SMOOTH);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glHint(GL_LINE_SMOOTH_HINT, GL_DONT_CARE);
//paintGL
glLineWidth(3.0);
glColor3f(.9f, .1f, .9f);
glBegin(GL_LINES);
glNormal3f(0.0f, 1.0f, 1.0f);
glVertex3f(X, Y, Z);
glVertex3f(X, Y+3, Z);
glEnd();
//initializeGL()
.....
glEnable(GL_BLEND);
glEnable(GL_LINE_SMOOTH);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glHint(GL_LINE_SMOOTH_HINT, GL_DONT_CARE);
//paintGL
glLineWidth(3.0);
glColor3f(.9f, .1f, .9f);
glBegin(GL_LINES);
glNormal3f(0.0f, 1.0f, 1.0f);
glVertex3f(X, Y, Z);
glVertex3f(X, Y+3, Z);
glEnd();
To copy to clipboard, switch view to plain text mode
Then I tried to put above instructions inside a function of onother object (scene::drawLine()
And I tried this:
//paintGL()
scene.drawLine(); // this is OK
scene.drawScene();
//paintGL()
scene.drawLine(); // this is OK
scene.drawScene();
To copy to clipboard, switch view to plain text mode
Scene::drawScene() {
drawSquare();
}
Scene::drawScene() {
drawSquare();
}
To copy to clipboard, switch view to plain text mode
Otherwise:
//paintGL()
scene.drawScene() //my line appear aliased!!!
//paintGL()
scene.drawScene() //my line appear aliased!!!
To copy to clipboard, switch view to plain text mode
Where:
Scene::drawScene() {
drawLine();
drawSquare();
}
Scene::drawScene() {
drawLine();
drawSquare();
}
To copy to clipboard, switch view to plain text mode
Anyone can tell me about this behavior?
Thaks
Bookmarks