42 #include <ACG/GL/acg_glew.hh> 43 #include "Renderer.hh" 51 #include <ACG/GL/gl.hh> 53 #include <OpenFlipper/common/ViewObjectMarker.hh> 54 #include <ACG/Utils/Profile.hh> 56 #include <ACG/Scenegraph/StencilRefNode.hh> 72 void Renderer::initializePlugin()
84 QSet<GLuint> references;
90 glClear(GL_STENCIL_BUFFER_BIT);
91 glStencilOp (GL_KEEP, GL_KEEP, GL_ZERO);
92 glStencilFunc (GL_ALWAYS, 0, ~0);
104 o_it->stencilRefNode ()->setReference (ref);
105 o_it->stencilRefNode ()->show ();
110 o_it->stencilRefNode ()->hide ();
126 for (
unsigned int i = 0; i <
sizeof (GLuint) * 8; i++)
127 if (refBits & (1 << i))
128 references << (1 << i);
131 glPushAttrib(GL_ALL_ATTRIB_BITS);
138 int vp_l, vp_b, vp_w, vp_h;
141 glMatrixMode(GL_PROJECTION);
144 glOrtho(0, vp_w, vp_h, 0, 0, 1.0);
145 glMatrixMode(GL_MODELVIEW);
149 glStencilOp (GL_KEEP, GL_KEEP, GL_KEEP);
151 foreach (
unsigned int ref, references)
157 unsigned int mask = ~0;
170 glStencilFunc (GL_EQUAL, ref, mask);
173 glColor4f (color[0], color [1], color [2], color[3]);
178 glVertex2i(vp_w, vp_h);
184 glMatrixMode(GL_PROJECTION);
186 glMatrixMode(GL_MODELVIEW);
197 QString Renderer::checkOpenGL()
200 return QString(
"Classic Rendering-plugin is not available for OpenGL core contexts.");
202 if ( !ACG::Profile::isCompatibilityProfile() )
203 return QString(
"This plugin requires an OpenGL compatibility context to work.");
static void enable(GLenum _cap, bool _warnRemoved=true)
replaces glEnable, but supports locking
virtual bool blendForStencilRefBit(GLuint _refbit, GLenum &_src, GLenum &_dst, ACG::Vec4f &_color)
Namespace providing different geometric functions concerning angles.
ACG::SceneGraph::BaseNode * getSceneGraphRootNode()
get scenegraph root node
void drawMode(ACG::SceneGraph::DrawModes::DrawMode _mode)
set draw mode (No test if this mode is available!)
void get_viewport(int &_left, int &_bottom, int &_width, int &_height) const
get viewport
const QStringList ALL_OBJECTS
Iterable object range.
void traverse_multipass(BaseNode *_node, Action &_action, const unsigned int &_pass)
void objectMarker(ViewObjectMarker *_marker)
set object marker for viewer
DLLEXPORT ObjectIterator objectsEnd()
Return Iterator to Object End.
Mark per returned reference bits.
virtual bool stencilRefForObject(BaseObjectData *_obj, GLuint &_reference)=0
static void disable(GLenum _cap, bool _warnRemoved=true)
replaces glDisable, but supports locking
virtual bool blendForStencilRefNumber(GLuint _reference, GLenum &_src, GLenum &_dst, ACG::Vec4f &_color)
static void blendFunc(GLenum _sfactor, GLenum _dfactor)
replaces glBlendFunc, supports locking
void compatibilityProfile(bool _enableCoreProfile)
Store opengl core profile setting.
const DataType DATA_ALL(UINT_MAX)
Identifier for all available objects.