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 

VBOs & Shared Geometry


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
Sean Spicer
Guest





PostPosted: Mon Dec 01, 2008 10:35 pm    Post subject:
VBOs & Shared Geometry
Reply with quote

Hi Gang,

I'm working on some code where it is desirable to share vertex & normal arrays across multiple drawables (these are osg::Geometry's), *and* to allow each drawable to have its own unique color (BIND_OVERALL). My thinking is that this can be done using VBOs, but I cannot find any good examples of how to do so, particularly with normals...

For example - See the two Questions inline below:

Step 1: Create the common Geometry, then:
Quote:
geom->setSupportsDisplayList(false);geom->setUseDisplayList(false);m_vertexBuffer = geom->getOrCreateVertexBufferObject();
m_vertexBuffer->setArray(0,&vertexArray);m_vertexBuffer->setUsage(GL_STATIC_COPY);// QUESTION 1: How to map the normal array?m_vertexBuffer->dirty();geom->setUseVertexBufferObjects(true);
Step 2: Create a second osg::Geometry node, but set its vertex buffer to the first one
Quote:
geom2->setSupportsDisplayList(false);geom2->setUseDisplayList(false);// QUESTION: I want to be able to do geom->setVertexBufferObject(m_vertexBuffer)
// But there is no API. Can this be done?geom2->setUseVertexBufferObjects(true);
Any help is much appreciated.

cheers,

sean

------------------
Post generated by Mail2Forum
Back to top
Brian R Hill
Guest





PostPosted: Mon Dec 01, 2008 11:12 pm    Post subject:
VBOs & Shared Geometry
Reply with quote

Try cloning the geoms and only changing their color array.

Brian

This is a PRIVATE message. If you are not the intended recipient, please
delete without copying and kindly advise us by e-mail of the mistake in
delivery.
NOTE: Regardless of content, this e-mail shall not operate to bind CSC to
any order or other contract unless pursuant to explicit written agreement
or government initiative expressly permitting the use of e-mail for such
purpose. ΓΆβ?¬ΒΆ
wrote: -----

To: osg-users <>
From: "Sean Spicer" <>
Sent by:
Date: 12/01/2008 05:35PM
Subject: VBOs & Shared Geometry

Hi Gang,

I'm working on some code where it is desirable to share vertex & normal
arrays across multiple drawables (these are osg::Geometry's), *and* to
allow each drawable to have its own unique color (BIND_OVERALL). My
thinking is that this can be done using VBOs, but I cannot find any good
examples of how to do so, particularly with normals...

For example - See the two Questions inline below:

Step 1: Create the common Geometry, then:
geom->setSupportsDisplayList(false);

geom->setUseDisplayList(false);

m_vertexBuffer = geom->getOrCreateVertexBufferObject();


m_vertexBuffer->setArray(0,&vertexArray);

m_vertexBuffer->setUsage(GL_STATIC_COPY);


// QUESTION 1: How to map the normal array?


m_vertexBuffer->dirty();

geom->setUseVertexBufferObjects(true);



Step 2: Create a second osg::Geometry node, but set its vertex buffer to
the first one
geom2->setSupportsDisplayList(false);

geom2->setUseDisplayList(false);


// QUESTION: I want to be able to do geom->setVertexBufferObject
(m_vertexBuffer)


// But there is no API. Can this be done?


geom2->setUseVertexBufferObjects(true);

Any help is much appreciated.

cheers,

sean





------------------
Post generated by Mail2Forum
Back to top
Robert Osfield
Guest





PostPosted: Tue Dec 02, 2008 9:14 am    Post subject:
VBOs & Shared Geometry
Reply with quote

Hi Sean,

osg::Geometry provides an automatic VBO setup for you when you
setUseVertexBufferObjects(true), but this is only done on a per
Geometry basis, the code assumes that there is just one geometry in
play.

If you want to use assign VBO's to Array's individually then you'll
need to assign the VBO's to the Array's yourself.

Robert.

On Mon, Dec 1, 2008 at 10:35 PM, Sean Spicer <> wrote:
Quote:
Hi Gang,

I'm working on some code where it is desirable to share vertex & normal
arrays across multiple drawables (these are osg::Geometry's), *and* to allow
each drawable to have its own unique color (BIND_OVERALL). My thinking is
that this can be done using VBOs, but I cannot find any good examples of how
to do so, particularly with normals...

For example - See the two Questions inline below:

Step 1: Create the common Geometry, then:

geom->setSupportsDisplayList(false);
geom->setUseDisplayList(false);
m_vertexBuffer = geom->getOrCreateVertexBufferObject();

m_vertexBuffer->setArray(0,&vertexArray);
m_vertexBuffer->setUsage(GL_STATIC_COPY);

// QUESTION 1: How to map the normal array?

m_vertexBuffer->dirty();
geom->setUseVertexBufferObjects(true);


Step 2: Create a second osg::Geometry node, but set its vertex buffer to the
first one

geom2->setSupportsDisplayList(false);
geom2->setUseDisplayList(false);

// QUESTION: I want to be able to do
geom->setVertexBufferObject(m_vertexBuffer)

// But there is no API. Can this be done?

geom2->setUseVertexBufferObjects(true);

Any help is much appreciated.

cheers,

sean







------------------
Post generated by Mail2Forum
Back to top
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General 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 Different views hide/show different n... icf80 General 13 Wed Apr 17, 2019 9:56 am View latest post
No new posts Removing objects with shared GL state... AnyOldName3 General 8 Wed Mar 20, 2019 5:05 pm View latest post
No new posts hidden geometry in embedded osg Meldryt General 1 Thu Feb 21, 2019 7:17 am View latest post
No new posts Happy New Year to all OSG Users Chris Hanson General 0 Mon Jan 07, 2019 10:17 am View latest post
No new posts osg-users Digest, Vol 138, Issue 27 Zachary1234 General 0 Tue Jan 01, 2019 1:16 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