Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Graphics > Inventor API > Redraw error
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 1 Topic 422 of 501
Post > Topic >>

Redraw error

by Dennis-Bendert Schramm <dennisschramm@[EMAIL PROTECTED] > Oct 28, 2005 at 10:16 PM

Hi,

I wrote a little sample program to test selection using Coin3D and the 
SoQt lib on SuSE Linux Pro 8.0.

The program compiles without any problem but as I click to select an 
object, it crashes with a "Memory Access Error".

The sample program is similar to the sample code that comes with the 
Coin Do***entation.

Here's the code:

#include <Inventor/Qt/SoQt.h>
#include <Inventor/Qt/viewers/SoQtExaminerViewer.h>
#include <Inventor/nodes/SoBaseColor.h>
#include <Inventor/nodes/SoCone.h>
#include <Inventor/nodes/SoSeparator.h>
#include <Inventor/nodes/SoSelection.h>
#include <Inventor/nodes/SoGroup.h>
#include <Inventor/actions/SoBoxHighlightRenderAction.h>

static SoSelection *group_node=NULL;

void made_selection( void * userdata, SoPath * path )
   {
     (void)fprintf( stdout, "%sselected %s\n",
                    userdata == (void *)1L ? "" : "de",
                    path->getTail()->getTypeId().getName().getString() );

     group_node->touch(); // to redraw
   }

int main(int argc, char ** argv) {
	// Initializes SoQt library (and implicitly also the Coin and Qt
	// libraries). Returns a top-level / shell Qt window to use.
	QWidget * mainwin = SoQt::init(argc, argv, argv[0]);
	
	// Make a dead simple scene graph by using the Coin library, only
	// containing a single yellow cone under the scenegraph root.
	SoSeparator * root = new SoSeparator;
	SoSelection *group_node=new SoSelection;
	
	group_node->policy = SoSelection::****FT;
	group_node->ref();
	
	SoBaseColor * col = new SoBaseColor;
	col->rgb = SbColor(1, 1, 0);
	group_node->addChild(col);
	
	group_node->addChild(new SoCone);
	group_node->addSelectionCallback( made_selection, (void *)1L );
	//group_node->touch();
     group_node->addDeselectionCallback( made_selection, (void *)0L );
	//group_node->touch();
	
	// Use one of the convenient SoQt viewer cl*****.
	SoQtExaminerViewer * eviewer = new SoQtExaminerViewer(mainwin);
	eviewer->setSceneGraph(group_node);
	eviewer->setGLRenderAction( new SoBoxHighlightRenderAction );
     eviewer->setViewing( FALSE );
	eviewer->show();
	
	// Pop up the main window.
	SoQt::show(mainwin);
	// Loop until exit.
	SoQt::mainLoop();
	
	// Clean up resources.
	delete eviewer;
	group_node->unref();
	
	return 0;
}

Anyone can help?

Thanks in advance,

Dennis Schramm

-- 
batchtranscode.sourceforge.net

"Sie war so fett, ich musste sie in Mehl waelzen, um die feuchte Stelle 
zu finden!"
 




 1 Posts in Topic:
Redraw error
Dennis-Bendert Schramm &l  2005-10-28 22:16:09 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Aug 27 17:15:30 CDT 2008.