Hi forestXX
Drawable uses the Template Design Pattern to automatically wrap up
OpenGL creation for you, the code for display lists set up is done
with Drawable::draw() which calls drawImplementation() only when the
drawable isn't using display lists or that display list is dirty.
In you code case you most likely don't need your own OpenGL display
list setup as this will done for you with Drawable::draw(), but if you
really do need to create display lists yourself then just disable the
automatic generation of display lists by doing
drawable->setUseDisplayList(false).
Robert.
On Fri, Apr 25, 2008 at 2:45 PM, forest37 <[EMAIL PROTECTED]> wrote:
>
> hi all,
> I want to use opengl display list in Drawable::drawImplementation ,like
> this:
>
> void ShapeDrawableEx::drawImplementation(osg::RenderInfo& renderInfo) const
> {
> if (globj==0) //ShapeDrawableEx:: mutable GLuint globj;
> {
> makeCallList();
> }
> glCallList( globj );
> }
>
> void ShapeDrawableEx::makeCallList() const
> {
> globj=glGenLists(1);
> if(globj!=0)
> {
> glNewList(globj,GL_COMPILE);
> ......
> glEndList();
> }
> }
> If the drawImplementation is first time called,it works well and I can see
> the drawing.
> But if I change the Drawable's color,that's to say the drawImplementation is
> called again,nothing is drawn.
> I know that the drawImplementation is called between glNewList and glEndList
> ,so it's a hierarchical display list.But it doesn't work well.
> Why?
>
> thanks
> forest37
>
>
>
> ________________________________
> 免费鸡翅比萨天天抽
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org