54 #include <ACG/GL/acg_glew.hh> 55 #include "LineNode.hh" 56 #include <ACG/GL/IRenderer.hh> 67 drawCompat(GLState& _state ,
const DrawModes::DrawMode& _drawMode)
80 if (line_mode_ == LineSegmentsMode)
83 if( (points_.size()/2 == colors4f_.size()) )
87 glGetBooleanv( GL_BLEND, &blendb);
91 glGetBooleanv( GL_DEPTH_WRITEMASK, &depthmaskb);
92 glDepthMask(GL_FALSE);
96 ConstPointIter p_it=points_.begin(), p_end=points_.end();
97 ConstColor4fIter c_it=colors4f_.begin();
99 Color4f c(1.0f,1.0f,1.0f,1.0f);
100 if(c_it != colors4f_.end()) {
105 for (; p_it!=p_end; ++p_it)
107 if ((cnt > 0) && (cnt % 2 == 0) && (c_it+1) != colors4f_.end()) {
121 if( blendb == GL_FALSE )
125 if( depthmaskb == GL_TRUE )
126 glDepthMask(GL_TRUE);
129 else if ((line_mode_ == LineSegmentsMode) && (points_.size()/2 == colors_.size()) )
132 ConstPointIter p_it=points_.begin(), p_end=points_.end();
133 ConstColorIter c_it=colors_.begin();
135 Color c((
char)255, (
char)255, (
char)255);
136 if(c_it != colors_.end()) {
141 for (; p_it!=p_end; ++p_it)
143 if ((cnt > 0) && (cnt % 2 == 0) && (c_it+1) != colors_.end()) {
159 ConstPointIter p_it=points_.begin(), p_end=points_.end();
161 for (; p_it!=p_end; ++p_it)
171 _state.set_color(_state.base_color());
172 glBegin(GL_LINE_STRIP);
173 ConstPointIter p_it=points_.begin(), p_end=points_.end();
174 for (; p_it!=p_end; ++p_it)
185 void LineNode::pickCompat(GLState& _state ,
PickTarget _target)
195 const size_t n_edges =
n_points() - 1;
201 _state.pick_set_maximum (n_edges);
202 pick_edgesCompat(_state, 0);
208 _state.pick_set_maximum (n_edges);
209 pick_edgesCompat(_state, 0);
223 void LineNode::pick_edgesCompat(GLState& _state,
unsigned int _offset)
229 const float line_width_old = _state.line_width();
231 _state.pick_set_name (0);
233 glDepthRange(0.0, 0.99);
235 if (line_mode_ == PolygonMode)
237 const size_t n_edges =
n_points() - 1;
238 for (
size_t i = 0; i < n_edges; ++i)
240 _state.pick_set_name(i + _offset);
242 glArrayElement(static_cast<GLint>(i));
243 glArrayElement(static_cast<GLint>(i + 1));
247 else if (line_mode_ == LineSegmentsMode)
249 const size_t n_edges =
n_points() / 2;
250 for (
size_t i = 0; i < n_edges; ++i)
252 _state.pick_set_name(i + _offset);
254 glArrayElement(static_cast<GLint>(2*i));
255 glArrayElement(static_cast<GLint>(2*i + 1));
260 glDepthRange(0.0, 1.0);
262 _state.set_line_width(line_width_old);
DrawMode WIREFRAME
draw wireframe
Namespace providing different geometric functions concerning angles.
pick any of the prior targets (should be implemented for all nodes)
static void bindBuffer(GLenum _target, GLuint _buffer)
replaces glBindBuffer, supports locking
static void disable(GLenum _cap, bool _warnRemoved=true)
replaces glDisable, but supports locking
float picking_line_width() const
get line width used by the picking renderer. Defaults to line_width().
void glVertex(const Vec2i &_v)
Wrapper: glVertex for Vec2i.
static void vertexPointer(GLint _size, GLenum _type, GLsizei _stride, const GLvoid *_pointer)
replaces glVertexPointer, supports locking
static void disableClientState(GLenum _cap)
replaces glDisableClientState, supports locking
static void enableClientState(GLenum _cap)
replaces glEnableClientState, supports locking
picks edges (may not be implemented for all nodes)
size_t n_points() const
number of points
PickTarget
What target to use for picking.
void glColor(const Vec3f &_v)
Wrapper: glColor for Vec3f.