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 

osgCompute - binding ColorArray failed


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> osgCompute [osgCompute]
View previous topic :: View next topic  
Author Message
arielh
Newbie


Joined: 29 Nov 2009
Posts: 5

PostPosted: Mon Nov 30, 2009 9:44 am    Post subject:
osgCompute - binding ColorArray failed
Reply with quote

Hi:
I try to expand the ptclParticleDemo.I want to add a color array and change the color in cuda program.
I try to "bind" the colorArray but i not sure hown to:
 
osg::Vec4Array *colors = new osg::Vec4Array(numParticles);
ptclGeom->setColorArray(colors);
ptclGeom->setColorBinding(osg::Geometry::BIND_PER_VERTEX);
 
osg::ref_ptr<osgCuda::Array> colorArray = new osgCuda::Array;
colorArray->setArray(colors);
colorArray->setName("colors");
srcArray->setElementSize(sizeof(osg::Vec4f));
srcArray->setDimension(0,numParticles);
srcArray->addHandle("PTCL_COLOR_BUFFER");
computation->addResource( *srcArray);
 
But not work properly.
Some One can help me???
Thanks
Ariel

------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
jens.svt
User


Joined: 16 Mar 2009
Posts: 30

PostPosted: Mon Nov 30, 2009 9:51 pm    Post subject:
Reply with quote

Hi arielh,

For this purpose you cannot make use of osgCuda::Arrays because buffers of this type are read-only. In order to add a color entry for each vertex you have to expand your osgCuda::Geometry object by an additional color array of type osg::Vec4Array=> myGeometry->setColorArray( new osg::Vec4Array ). The vertex buffer object of this geometry is then extended by the respective color data. During your computation you need to know this offset to address the color data (In your case this should be something like "sizeof(Vec4f) * numVertices").


I hope this information will help you.

Cheers,
Jens
Back to top
View user's profile Send private message
jens.svt
User


Joined: 16 Mar 2009
Posts: 30

PostPosted: Mon Nov 30, 2009 9:52 pm    Post subject:
Reply with quote

Hi arielh,

For this purpose you cannot make use of osgCuda::Arrays because buffers of this type are read-only. In order to add a color entry for each vertex you have to expand your osgCuda::Geometry object by an additional color array of type osg::Vec4Array=> myGeometry->setColorArray( new osg::Vec4Array ). The vertex buffer object of this geometry is then extended by the respective color data. During your computation you need to know this offset to address the color data (In your case this should be something like "sizeof(Vec4f) * numVertices").


I hope this information will help you.

Cheers,
Jens
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> osgCompute [osgCompute] 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 osgQt failed in QT 5.10.1 + osg 3.6 feelapi General [3rdparty] 3 Fri May 11, 2018 12:31 pm View latest post
No new posts Database pager and failed loading of ... hartwigw General 3 Sun Mar 04, 2018 5:51 pm View latest post
No new posts Database pager and failed loading of ... hartwigw Submission 2 Sun Mar 04, 2018 5:42 pm View latest post
No new posts Win 10 + VS17 + OSG 3.2.3 = Failed to... Paradox Plugins [osgPlugins] 1 Mon Jan 29, 2018 9:57 am View latest post
No new posts FBO setup failed Trajce Nikolov NICK General 1 Sat Dec 23, 2017 2:48 am 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