Hi All,
I have this very strange behavior in my application based upon OSG 2.8.0.
I derived my own drawable, MyDrawable, from osg::Drawable, and implemented the
drawImplementation, to be called by OSG during draw rendering traversal.
It works correctly, the geometry in my drawable is rendered correctly on the
screen.
Internally MyDrawable::drawImplementation has to bound the geometry in a
display list, to speed up drawing of complex geometry, but I cannot use the
automatic OSG mechanism to wrap it (I mean, I cannot simply call
MyDrawable::setUseDisplayList(true)).
So, I have to call something like:
p_listID = glGenLists(1);
on my own, and fill the display list by glNewList(...), etc...
Once the display list is created, I simply call
glList(p_listID);
in MyDrawable::drawImplementation(...).
It works fine, even if for some complex model I have this strange behavior. In
one case I have 2 objects of type MyDrawable instantiated.
The first time drawImplementation is called for obj1, a p_listID = 6 is
returned from glGenLists(1);
Then, the first time drawImplementation is called for obj2, glGenLists(1) still
return 6 as the first available ID.
What happens actually is that the first rendering does not render obj2, because
it is out of viewing volume.
In second rendering, after the camera has been moved, both objects fall in the
viewing volume.
As soon as drawing traversal encounters MyDrawable for obj1, I checked the
availability of ID for display lists, by calling:
GLboolean isList[1000];
int i;
for (i=0; i<1000; ++i)
isList[i] = glIsList(i);
And discovered that available display list IDs are from 1 to 5. So, my display
list #6 has been deleted, but I cannot understand who has done that.
I put a breakpoint in the place I delete the display list:
glDeleteLists(p_listID, 1)
but that is never reached between the first and second rendering.
So, I wonder if OSG somehow deletes some display lists, and why. I looked in
the code, and see the osg::Drawable actually calls glDeleteLists(...)
in several places, so I can only guess that it deletes it there. Even if I
cannot understand how that is possible, since OSG does not know the ID that has
been returned to MyDrawable from glGenLists(1).
I should rebuild OSG 2.8.0 and debug it, to see if the deletion happens there.
But before doing that, I would like to hear from you if there is any chance
that OSG might have been deleted
a wrong display list (at least, if that is an issue already reported by someone
else, or even better if there is a fix for that).
Thanks in advance,
Gianluca Natale
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org