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 what should I dirty when I change Col... Trajce Nikolov NICK General 2 Wed May 03, 2017 6:47 pm View latest post
No new posts osg build (master) failed with VS2013... Trajce Nikolov NICK General 1 Thu Feb 09, 2017 2:26 pm View latest post
No new posts Warnings: Failed grabbing the focus a... umadevi2193 General 3 Fri Nov 11, 2016 7:49 am View latest post
No new posts Ubuntu build failed the latest from g... Trajce Nikolov NICK General 4 Mon Aug 22, 2016 1:11 pm View latest post
No new posts iOS & GLES2 : VERTEX glCompileSha... skylook General 8 Fri Nov 07, 2014 9:14 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