- 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);
|
||||
glLineWidth(2.5);
|
||||
glPointSize(5.0);
|
||||
if(currentphase==RUBBER_DRAGGING ) {
|
||||
|
||||
if(currentphase==RUBBER_DRAGGING )
|
||||
{
|
||||
Point2f qt_start_point = DevicePixelConvert(start);
|
||||
glColor(color);
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
|
|
@ -99,13 +101,17 @@ void Rubberband::Render(QGLWidget* gla)
|
|||
glPopMatrix();
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPopMatrix();
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
assert(currentphase == RUBBER_DRAGGED);
|
||||
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_POINT_SMOOTH);
|
||||
glColor(color);
|
||||
glLineWidth(2.0);
|
||||
glPointSize(4.0);
|
||||
glBegin(GL_LINES);
|
||||
glVertex(start);
|
||||
glVertex(end);
|
||||
|
|
@ -114,9 +120,9 @@ void Rubberband::Render(QGLWidget* gla)
|
|||
glVertex(start);
|
||||
glVertex(end);
|
||||
glEnd();
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glLineWidth(0.7f);
|
||||
glPointSize(1.4f);
|
||||
glDepthFunc(GL_GREATER);
|
||||
glLineWidth(1.0f);
|
||||
glPointSize(2.0f);
|
||||
glBegin(GL_LINES);
|
||||
glVertex(start);
|
||||
glVertex(end);
|
||||
|
|
@ -125,7 +131,51 @@ void Rubberband::Render(QGLWidget* gla)
|
|||
glVertex(start);
|
||||
glVertex(end);
|
||||
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();
|
||||
assert(!glGetError());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,6 +74,16 @@ public:
|
|||
*/
|
||||
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.
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue