54 #include <ACG/GL/acg_glew.hh>
55 #include <ACG/GL/gl.hh>
57 #include "Renderer.hh"
59 #include <OpenFlipper/common/ViewObjectMarker.hh>
77 void Renderer::initializePlugin()
89 QSet<GLuint> references;
93 glClear (GL_STENCIL_BUFFER_BIT);
95 glStencilOp (GL_KEEP, GL_KEEP, GL_ZERO);
96 glStencilFunc (GL_ALWAYS, 0, ~0);
108 o_it->stencilRefNode ()->setReference (ref);
109 o_it->stencilRefNode ()->show ();
114 o_it->stencilRefNode ()->hide ();
130 for (
unsigned int i = 0; i <
sizeof (GLuint) * 8; i++)
131 if (refBits & (1 << i))
132 references << (1 << i);
135 glPushAttrib(GL_ALL_ATTRIB_BITS);
142 int vp_l, vp_b, vp_w, vp_h;
145 glMatrixMode(GL_PROJECTION);
148 glOrtho(0, vp_w, vp_h, 0, 0, 1.0);
149 glMatrixMode(GL_MODELVIEW);
153 glStencilOp (GL_KEEP, GL_KEEP, GL_KEEP);
155 foreach (
unsigned int ref, references)
161 unsigned int mask = ~0;
174 glStencilFunc (GL_EQUAL, ref, mask);
177 glColor4f (color[0], color [1], color [2], color[3]);
182 glVertex2i(vp_w, vp_h);
188 glMatrixMode(GL_PROJECTION);
190 glMatrixMode(GL_MODELVIEW);
201 QString Renderer::checkOpenGL()
204 if ( QGLContext::currentContext()->format().profile() != QGLFormat::CompatibilityProfile )
205 return QString(
"This plugin requires an OpenGL compatibility context to work.");
213 #if QT_VERSION < 0x050000
214 Q_EXPORT_PLUGIN2( classicalrenderer ,
Renderer );
virtual bool blendForStencilRefBit(GLuint _refbit, GLenum &_src, GLenum &_dst, ACG::Vec4f &_color)
static void enable(GLenum _cap)
replaces glEnable, but supports locking
Namespace providing different geometric functions concerning angles.
const QStringList ALL_OBJECTS
Iterable object range.
virtual bool stencilRefForObject(BaseObjectData *_obj, GLuint &_reference)=0
void drawMode(ACG::SceneGraph::DrawModes::DrawMode _mode)
set draw mode (No test if this mode is available!)
void traverse_multipass(BaseNode *_node, Action &_action, const unsigned int &_pass)
ACG::SceneGraph::BaseNode * getSceneGraphRootNode()
get scenegraph root node
virtual bool blendForStencilRefNumber(GLuint _reference, GLenum &_src, GLenum &_dst, ACG::Vec4f &_color)
void objectMarker(ViewObjectMarker *_marker)
set object marker for viewer
static void blendFunc(GLenum _sfactor, GLenum _dfactor)
replaces glBlendFunc, supports locking
Mark per returned reference bits.
DLLEXPORT ObjectIterator objectsEnd()
Return Iterator to Object End.
const DataType DATA_ALL(UINT_MAX)
Identifier for all available objects.
void get_viewport(int &_left, int &_bottom, int &_width, int &_height) const
get viewport
static void disable(GLenum _cap)
replaces glDisable, but supports locking