Horde3D

Next-Generation Graphics Engine
It is currently 22.11.2024, 01:09

All times are UTC + 1 hour




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: 26.04.2011, 10:01 
Offline

Joined: 15.02.2009, 02:13
Posts: 161
Location: Sydney Australia
Hi all,

When I make a call to h3dAddGroupNode when I want to make an "Anchor" node for my camera to pivot around, eg.
Code:
_anchor = h3dAddGroupNode( H3DRootNode, "Anchor" );

(Where _anchor is just a H3DNode member in my class) I get an EXC_BAD_ACCESS while I'm porting to iOS. Afaik this is due to accessing an object which doesn't exist or has been removed from the stack or an object access which isn't expected, some confusing stuff for a novice C++ programmer like me :) but it seems to only affect iOS as my port to the N900 didn't encounter any issues like this. Also a call to h3dAddCameraNode doesn't seem to have any issues. The exact offending call is here in egMain.cpp:
Code:
DLLEXP NodeHandle h3dAddGroupNode( NodeHandle parent, const char *name )
{
   SceneNode *parentNode = Modules::sceneMan().resolveNodeHandle( parent );
   APIFUNC_VALIDATE_NODE( parentNode, "h3dAddGroupNode", 0 );

   //Modules::log().writeInfo( "Adding Group node '%s'", safeStr( name ).c_str() );
   GroupNodeTpl tpl( safeStr( name, 0 ) );
   SceneNode *sn = Modules::sceneMan().findType( SceneNodeTypes::Group )->factoryFunc( tpl ); //<-- this call right here gives off an EXC_BAD_ACCESS
   return Modules::sceneMan().addNode( sn, *parentNode );
}

My naive problem solving tells me it is because of the casting from a SceneNodeTpl to a GroupNodeTpl on a const? In here:
Code:
SceneNode *GroupNode::factoryFunc( const SceneNodeTpl &nodeTpl )
{
   if( nodeTpl.type != SceneNodeTypes::Group ) return 0x0;
   
   return new GroupNode( *(GroupNodeTpl *)&nodeTpl ); //<-- right here
}

This might be just specific for iOS but I think it might be an issue in the long run for the desktop builds, I'm curious now if the OS X port has this issue when adding a group node... If this is a trivial problem on my part I apologise but I thought I might as well post about it, thanks!

_________________
-Alex
Website


Top
 Profile  
Reply with quote  
PostPosted: 28.05.2011, 10:22 
Offline
Engine Developer

Joined: 10.09.2006, 15:52
Posts: 1217
Sorry MistaED, this topic stayed under our radar.

Could it be that findType is returning NULL in that case?


Top
 Profile  
Reply with quote  
PostPosted: 30.05.2011, 00:21 
Offline

Joined: 15.02.2009, 02:13
Posts: 161
Location: Sydney Australia
Not a problem marciano :)

Xcode is a little funny for iOS, partial recompiles are completely unreliable so compiling from scratch for every change seems to aleviate the issue, plus I need to take into account the app lifecycles and their pseudo multitasking I think...

_________________
-Alex
Website


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 3 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group