42 #include "VolumeMeshNode.hh" 52 template<
class VolumeMeshT>
62 if (lastCellDrawMode_)
76 glDrawArrays(GL_TRIANGLES, 0, cellsBufferManager_.getNumOfVertices());
82 if (lastFaceDrawMode_)
96 glDrawArrays(GL_TRIANGLES, 0, facesBufferManager_.getNumOfVertices());
102 GLenum oldDepthFunc = _state.
depthFunc();
111 vertexPickBufferManager_.invalidateColors();
113 pickVerticesCompat(_state);
119 pickEdgesCompat(_state, 0);
125 pickFacesCompat(_state, 0);
131 pickCellsCompat(_state, 0);
137 vertexPickBufferManager_.invalidateColors();
139 int nv = mesh_.n_vertices();
140 int ne = mesh_.n_edges();
141 int nf = mesh_.n_faces();
142 int nc = mesh_.n_cells();
145 pickVerticesCompat(_state);
146 pickEdgesCompat(_state, nv);
147 pickFacesCompat(_state, nv + ne);
148 pickCellsCompat(_state, nv + ne + nf);
158 lastPickTarget_ = _target;
161 if (clientStateEnabledVertexArray)
166 if (clientStateEnabledColorArray)
171 if (clientStateEnabledNormalArray)
176 if (clientStateEnabledTexCoordArray)
187 template<
class VolumeMeshT>
190 if (lastDrawMode_ & drawModes_.vertexBasedDrawModes)
191 vertexPickBufferManager_.enableVertexPrimitives();
192 else if (lastDrawMode_ & drawModes_.cellBasedDrawModes)
193 vertexPickBufferManager_.enableVertexOnCellPrimitives();
195 vertexPickBufferManager_.enableVertexPrimitives();
197 vertexPickBufferManager_.disableNormals();
198 vertexPickBufferManager_.enablePickColors();
208 GLState::colorPointer(4, GL_UNSIGNED_BYTE, vertexPickBufferManager_.getStride(),
reinterpret_cast<GLvoid*
>(vertexPickBufferManager_.getColorOffset()));
216 glDrawArrays(GL_POINTS, 0, vertexPickBufferManager_.getNumOfVertices());
228 template<
class VolumeMeshT>
231 if ((lastDrawMode_ & (drawModes_.cellBasedDrawModes | drawModes_.edgesOnCells)) && !(lastDrawMode_ & (drawModes_.edgeBasedDrawModes & ~drawModes_.edgesOnCells)))
232 edgePickBufferManager_.enableEdgeOnCellPrimitives();
234 edgePickBufferManager_.enableEdgePrimitives();
236 edgePickBufferManager_.enablePickColors();
237 edgePickBufferManager_.disableNormals();
239 GLState::bindBuffer(GL_ARRAY_BUFFER, edgePickBufferManager_.getPickBuffer(_state, _offset));
245 GLState::colorPointer(4, GL_UNSIGNED_BYTE, edgePickBufferManager_.getStride(),
reinterpret_cast<GLvoid*
>(edgePickBufferManager_.getColorOffset()));
253 glDrawArrays(GL_LINES, 0, edgePickBufferManager_.getNumOfVertices());
265 template<
class VolumeMeshT>
268 if (lastDrawMode_ & (drawModes_.faceBasedDrawModes | drawModes_.halffaceBasedDrawModes))
269 facePickBufferManager_.enableFacePrimitives();
270 else if (lastDrawMode_ & drawModes_.cellBasedDrawModes)
271 facePickBufferManager_.enableFaceOnCellPrimitives();
273 facePickBufferManager_.enableFacePrimitives();
275 facePickBufferManager_.disableNormals();
276 facePickBufferManager_.enablePickColors();
278 GLState::bindBuffer(GL_ARRAY_BUFFER, facePickBufferManager_.getPickBuffer(_state, _offset));
284 GLState::colorPointer(4, GL_UNSIGNED_BYTE, facePickBufferManager_.getStride(),
reinterpret_cast<GLvoid*
>(facePickBufferManager_.getColorOffset()));
289 glDrawArrays(GL_TRIANGLES, 0, facePickBufferManager_.getNumOfVertices());
298 template<
class VolumeMeshT>
301 cellPickBufferManager_.enablePickColors();
302 cellPickBufferManager_.disableNormals();
303 cellPickBufferManager_.enableCellPrimitives();
305 GLState::bindBuffer(GL_ARRAY_BUFFER, cellPickBufferManager_.getPickBuffer(_state, _offset));
311 GLState::colorPointer(4, GL_UNSIGNED_BYTE, cellPickBufferManager_.getStride(),
reinterpret_cast<GLvoid*
>(cellPickBufferManager_.getColorOffset()));
316 glDrawArrays(GL_TRIANGLES, 0, cellPickBufferManager_.getNumOfVertices());
const Vec4f & specular_color() const
get specular color
void pickFacesCompat(GLState &_state, unsigned int _offset)
pick faces using opengl compatibility profile
static void depthRange(GLclampd _zNear, GLclampd _zFar)
replaces glDepthRange, supports locking
void pickCellsCompat(GLState &_state, unsigned int _offset)
pick cells using opengl compatibility profile
Namespace providing different geometric functions concerning angles.
void pickCompat(GLState &_state, PickTarget _target)
picking using opengl compatibility profile
pick any of the prior targets (should be implemented for all nodes)
static void colorPointer(GLint _size, GLenum _type, GLsizei _stride, const GLvoid *_pointer)
replaces glColorPointer, supports locking
const GLenum & depthFunc() const
get glDepthFunc() that is supposed to be active
void pickEdgesCompat(GLState &_state, unsigned int _offset)
pick edges using opengl compatibility profile
VectorT< float, 4 > Vec4f
void set_color(const Vec4f &_col)
set color
float point_size() const
get point size
float line_width() const
get line width
void set_depthFunc(const GLenum &_depth_func)
Call glDepthFunc() to actually change the depth comparison function, and store the new value in this ...
static void disableClientState(GLenum _cap)
replaces glDisableClientState, supports locking
void set_point_size(float _f)
set point size
void set_line_width(float _f)
set line width
static void shadeModel(GLenum _mode)
replaces glShadeModel, supports locking
void pickVerticesCompat(GLState &_state)
pick vertices using opengl compatibility profile
picks edges (may not be implemented for all nodes)
static void vertexPointer(GLint _size, GLenum _type, GLsizei _stride, const GLvoid *_pointer)
replaces glVertexPointer, supports locking
PickTarget
What target to use for picking.
picks faces (may not be implemented for all nodes)
static void bindBuffer(GLenum _target, GLuint _buffer)
replaces glBindBuffer, supports locking
picks faces (should be implemented for all nodes)
static bool isClientStateEnabled(GLenum _cap)
returns true, if a client state is enabled
static void disable(GLenum _cap, bool _warnRemoved=true)
replaces glDisable, but supports locking
static void enableClientState(GLenum _cap)
replaces glEnableClientState, supports locking
picks verices (may not be implemented for all nodes)
bool pick_set_maximum(size_t _idx)
Set the maximal number of primitives/components of your object.