- changed rubberband rendering mode (now draws in XOR)
- added secondary rendering function of line A->B (with no side-effects)
This commit is contained in:
parent
35ed4897f6
commit
f66fed8c6a
|
|
@ -79,7 +79,9 @@ void Rubberband::Render(QGLWidget* gla)
|
||||||
glDepthMask(false);
|
glDepthMask(false);
|
||||||
glLineWidth(2.5);
|
glLineWidth(2.5);
|
||||||
glPointSize(5.0);
|
glPointSize(5.0);
|
||||||
if(currentphase==RUBBER_DRAGGING ) {
|
|
||||||
|
if(currentphase==RUBBER_DRAGGING )
|
||||||
|
{
|
||||||
Point2f qt_start_point = DevicePixelConvert(start);
|
Point2f qt_start_point = DevicePixelConvert(start);
|
||||||
glColor(color);
|
glColor(color);
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
|
|
@ -99,13 +101,17 @@ void Rubberband::Render(QGLWidget* gla)
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
glMatrixMode(GL_MODELVIEW);
|
glMatrixMode(GL_MODELVIEW);
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
assert(currentphase == RUBBER_DRAGGED);
|
assert(currentphase == RUBBER_DRAGGED);
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_COLOR);
|
||||||
glEnable(GL_LINE_SMOOTH);
|
glEnable(GL_LINE_SMOOTH);
|
||||||
glEnable(GL_POINT_SMOOTH);
|
glEnable(GL_POINT_SMOOTH);
|
||||||
glColor(color);
|
glColor(color);
|
||||||
|
glLineWidth(2.0);
|
||||||
|
glPointSize(4.0);
|
||||||
glBegin(GL_LINES);
|
glBegin(GL_LINES);
|
||||||
glVertex(start);
|
glVertex(start);
|
||||||
glVertex(end);
|
glVertex(end);
|
||||||
|
|
@ -114,9 +120,9 @@ void Rubberband::Render(QGLWidget* gla)
|
||||||
glVertex(start);
|
glVertex(start);
|
||||||
glVertex(end);
|
glVertex(end);
|
||||||
glEnd();
|
glEnd();
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDepthFunc(GL_GREATER);
|
||||||
glLineWidth(0.7f);
|
glLineWidth(1.0f);
|
||||||
glPointSize(1.4f);
|
glPointSize(2.0f);
|
||||||
glBegin(GL_LINES);
|
glBegin(GL_LINES);
|
||||||
glVertex(start);
|
glVertex(start);
|
||||||
glVertex(end);
|
glVertex(end);
|
||||||
|
|
@ -125,7 +131,51 @@ void Rubberband::Render(QGLWidget* gla)
|
||||||
glVertex(start);
|
glVertex(start);
|
||||||
glVertex(end);
|
glVertex(end);
|
||||||
glEnd();
|
glEnd();
|
||||||
|
glDepthFunc(GL_LESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
glPopAttrib();
|
||||||
|
assert(!glGetError());
|
||||||
|
}
|
||||||
|
|
||||||
|
void Rubberband::RenderLine(QGLWidget* gla, Point3f AA, Point3f BB)
|
||||||
|
{
|
||||||
|
// Drawing of the line from AA to BB
|
||||||
|
glPushAttrib(GL_DEPTH_BUFFER_BIT | GL_ENABLE_BIT | GL_LINE_BIT | GL_POINT_BIT | GL_CURRENT_BIT | GL_LIGHTING_BIT | GL_COLOR_BUFFER_BIT);
|
||||||
|
glDisable(GL_LIGHTING);
|
||||||
|
glDisable(GL_TEXTURE_2D);
|
||||||
|
glDepthMask(false);
|
||||||
|
glLineWidth(2.5);
|
||||||
|
glPointSize(6.0);
|
||||||
|
glEnable(GL_BLEND);
|
||||||
|
glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ONE_MINUS_SRC_COLOR);
|
||||||
|
glEnable(GL_LINE_SMOOTH);
|
||||||
|
glEnable(GL_POINT_SMOOTH);
|
||||||
|
glColor(color);
|
||||||
|
glLineWidth(2.0);
|
||||||
|
glPointSize(5.0);
|
||||||
|
glBegin(GL_LINES);
|
||||||
|
glVertex(AA);
|
||||||
|
glVertex(BB);
|
||||||
|
glEnd();
|
||||||
|
glBegin(GL_POINTS);
|
||||||
|
glVertex(AA);
|
||||||
|
glVertex(BB);
|
||||||
|
glEnd();
|
||||||
|
glDepthFunc(GL_GREATER);
|
||||||
|
glLineWidth(1.0f);
|
||||||
|
glPointSize(2.0f);
|
||||||
|
glBegin(GL_LINES);
|
||||||
|
glVertex(AA);
|
||||||
|
glVertex(BB);
|
||||||
|
glEnd();
|
||||||
|
glBegin(GL_POINTS);
|
||||||
|
glVertex(AA);
|
||||||
|
glVertex(BB);
|
||||||
|
glEnd();
|
||||||
|
glDepthFunc(GL_LESS);
|
||||||
|
|
||||||
glPopAttrib();
|
glPopAttrib();
|
||||||
assert(!glGetError());
|
assert(!glGetError());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,16 @@ public:
|
||||||
*/
|
*/
|
||||||
void Render(QGLWidget* glw);
|
void Render(QGLWidget* glw);
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
@brief RenderLine draws a line from two points.
|
||||||
|
|
||||||
|
@param glw the GL widget.
|
||||||
|
@param AA the start point.
|
||||||
|
@param BB the end point.
|
||||||
|
*/
|
||||||
|
void RenderLine(QGLWidget* gla, Point3f AA, Point3f BB);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@brief Set the current rubberband endpoint.
|
@brief Set the current rubberband endpoint.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue