OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

Empty Primitive Sets Violate STL Preconditions On Draw


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> Submission
View previous topic :: View next topic  
Author Message
Lilith Bryant
Guest





PostPosted: Mon Dec 21, 2009 11:18 pm    Post subject:
Empty Primitive Sets Violate STL Preconditions On Draw
Reply with quote

Primitive sets element's draw routines (DrawElementsUByte::draw etc),
currently call front(), even when they are empty().

This causes "iterator-check" exceptions to be thrown in Debug mode with
MSVC 2008.

This patch simply wraps the whole body of the DrawElementsXXX::draw functions
in an "if (!empty())" clause. This also prevents a no-op OpenGL call.

This patch is against the SVN head.




------------------
Post generated by Mail2Forum
Back to top
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12279

PostPosted: Tue Dec 22, 2009 9:11 am    Post subject:
Empty Primitive Sets Violate STL Preconditions On Draw
Reply with quote

Hi Lilith,

Adding a check for every call to DrawElements is a bad way to solve
this potential problem as it introduces a calling overhead at a very
fine grained level.

In your model to you have zero length DrawElements?

Robert.

On Mon, Dec 21, 2009 at 11:15 PM, Lilith Bryant <> wrote:
Quote:
Primitive sets element's draw routines (DrawElementsUByte::draw etc),
currently call front(),  even when they are empty().

This causes "iterator-check" exceptions to be thrown in Debug mode with
MSVC 2008.

This patch simply wraps the whole body of the DrawElementsXXX::draw functions
in an "if (!empty())" clause.   This also prevents a no-op OpenGL call.

This patch is against the SVN head.







------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Lilith Bryant
Guest





PostPosted: Tue Dec 22, 2009 9:30 am    Post subject:
Empty Primitive Sets Violate STL Preconditions On Draw
Reply with quote

OK. Fine.

BTW, I discovered this importing a variety of a client's collection of weird
and wonderful (but valid) .dae and .fbx files.

I will modify those importers to never generate the empty DrawElements in the
first place. Would that be acceptable?

On 12/22/2009 10:11:07 PM, Robert Osfield wrote:
Quote:
Hi Lilith,

Adding a check for every call to DrawElements is a bad way to solve
this potential problem as it introduces a calling overhead at a very
fine grained level.

In your model to you have zero length DrawElements?

Robert.

On Mon, Dec 21, 2009 at 11:15 PM, Lilith Bryant <> wrote:
Quote:
Primitive sets element's draw routines (DrawElementsUByte::draw etc),
currently call front(),  even when they are empty().

This causes "iterator-check" exceptions to be thrown in Debug mode with
MSVC 2008.

This patch simply wraps the whole body of the DrawElementsXXX::draw
functions
Quote:
in an "if (!empty())" clause.   This also prevents a no-op OpenGL call.

This patch is against the SVN head.



openscenegraph.org

openscenegraph.org






------------------
Post generated by Mail2Forum
Back to top
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12279

PostPosted: Tue Dec 22, 2009 9:38 am    Post subject:
Empty Primitive Sets Violate STL Preconditions On Draw
Reply with quote

Hi Lilith,

On Tue, Dec 22, 2009 at 9:27 AM, Lilith Bryant <> wrote:
Quote:
OK.  Fine.

BTW, I discovered this importing a variety of a client's collection of weird
and wonderful (but valid) .dae and .fbx files.

I will modify those importers to never generate the empty DrawElements in the
first place.   Would that be acceptable?

Fixing the problem at source is certainly the right way to solve the
problem. Another solution might be to post process the osg::Geometry
to discard the invalid DrawElements. Adding a to/modifying an
existing visitor in osgUtil::Optimizer would be one place to add the
invalid data check + fix, another would be to add a convenience method
into osg::Geometry to fix up the data. In both cases you'd still need
a call to remove the problem data though.

Robert.


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> Submission All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts long waiting time between cull and draw tomas259 General 0 Wed Jul 03, 2019 7:47 pm View latest post
No new posts openGL error 'stack overflow' at afte... nebsar General 7 Sun Dec 23, 2018 6:05 am View latest post
No new posts DirectX Texture Stage Sets to OSG sbrkopac General 2 Tue Dec 04, 2018 8:47 pm View latest post
No new posts Switch between primitive and model charlietan789 General 2 Mon Nov 12, 2018 2:25 am View latest post
No new posts Extra draw calls in osgText? gwaldron General 1 Thu Jul 19, 2018 8:48 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP