PDA

View Full Version : Help on OpenGL in PaintGL



mickey
14th April 2006, 16:29
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();

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();



Scene::drawScene() {
drawSquare();
}
Otherwise:


//paintGL()
scene.drawScene() //my line appear aliased!!!
Where:


Scene::drawScene() {
drawLine();
drawSquare();
}
Anyone can tell me about this behavior?
Thaks

dimitri
15th April 2006, 22:17
This shouldn't happen. I would suggest trying to reproduce the problem in a minimal compilable example, for example by stripping down your program. Either you'll find the error while simplifying the program or you can post the minimal example here.