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 

Draw geometry on demand


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
sergio2k18
Newbie


Joined: 01 May 2018
Posts: 10

PostPosted: Sun Jun 10, 2018 7:53 am    Post subject:
Draw geometry on demand
Reply with quote

Hi,

I like to know how to redraw geometry on demand.
I have a osg:geometry with attached VertexArray and PrimitiveSet.
I need to send draw command to redraw geometry.
I see there is a "draw" method in DrawElements class, but that wants
an osg::State that i dont know how to get.
Or alternatively is there any other procedure how to do that, like some UpdateCallback?
Can anyone help me?

Thank you!

Cheers,
Tyler
Back to top
View user's profile Send private message
sergio2k18
Newbie


Joined: 01 May 2018
Posts: 10

PostPosted: Sun Jun 10, 2018 6:20 pm    Post subject:
Reply with quote

Hi,

Maybe with an osg::Drawable::DrawCallback?

Thank you!

Cheers,
Tyler
Back to top
View user's profile Send private message
wernerM
User


Joined: 06 Feb 2013
Posts: 82

PostPosted: Sun Jun 10, 2018 7:22 pm    Post subject:
Draw geometry on demand
Reply with quote

Hi Tyler,
if you set a new vertex array or change an existing on in a drawable of the scene graph it should show the changes in the next render frame. There is no need for doing something special. Maybe you have to set the modified array sorry. That's all.

On 10. Juni 2018 09:53:34 MESZ, Tyler Durden <> wrote:
Quote:
Quote:
Hi,I like to know how to redraw geometry on demand.I have a osg:geometry with attached VertexArray and PrimitiveSet.I need to send draw command to redraw geometry.I see there is a "draw" method in DrawElements class, but that wants an osg::State that i dont know how to get. Or alternatively is there any other procedure how to do that, like some UpdateCallback?Can anyone help me?Thank you!Cheers,Tyler------------------Read this topic online here:http://forum.openscenegraph.org/viewtopic.php?p=74018#74018osg-users mailing http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 11924

PostPosted: Mon Jun 11, 2018 6:40 am    Post subject:
Draw geometry on demand
Reply with quote

HI Tyler.

Quote:
I like to know how to redraw geometry on demand.
I have a osg:geometry with attached VertexArray and PrimitiveSet.
I need to send draw command to redraw geometry.
I see there is a "draw" method in DrawElements class, but that wants
an osg::State that i dont know how to get.
Or alternatively is there any other procedure how to do that, like some UpdateCallback?
Can anyone help me?

You don't normally draw "on demand" with a scene graph, it's purpose
is to manage the culling and draw dispatch for you.

There are times when you can manage low level rendering, but this
tends to be niche task done for very specific techniques, it's
something I'd expect advanced users might consider occasionally, but
for the most part users will likely never call the low level draw code
themselves.

Could you take a step back and explain what you are trying to do at a
higher level. I suggest this as there may well be a much more
straight forward way of doing things that starting to get your hand
dirty with low level stuff.

Robert.


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
sergio2k18
Newbie


Joined: 01 May 2018
Posts: 10

PostPosted: Fri Jun 15, 2018 2:07 pm    Post subject:
Reply with quote

Hi,

Sorry for my late answer.
Forget about my last question.
What i'm trying is to use a single mesh to draw a terrain in a quadtree.
I want reuse same geometry over quadtree's nodes.

My problem is to use a single grid mesh (only x-y plane, because i use
Vertex texture fetch on vertex shader to sample heights from a Texture2D).
For this purpose i'm using geometry instancing, by invoking setNumInstances of DrawElementsUInt class.
My problem now is to add some vertex attribute to shader capable to
distinguish from geometry instance.
For this purpose i'm using


Code:

osg::StateSet* ss = new osg::StateSet();
ss->setAttribute(new osg::VertexAttribDivisor(index,1));

where index is the slot of a particular vertex attribute.
If i have 4 instances of a geometry, how many time i have to invoke setAttribute for 4 different values? 4 times?

Thank you!

Cheers,
Tyler
Back to top
View user's profile Send private message
sergio2k18
Newbie


Joined: 01 May 2018
Posts: 10

PostPosted: Fri Jun 15, 2018 5:32 pm    Post subject:
Reply with quote

Hi,

Rollback: i got it working. Now i can use geometry instancing with
VertexAttribDivisor too.
There was some misunderstanding about my code organization.

Thank you!

Cheers,
Tyler
Back to top
View user's profile Send private message
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 Draw two translucent geometries in sp... krikr42 General 8 Fri May 18, 2018 1:42 pm View latest post
No new posts geometry shader with opengles lyn General 3 Mon Apr 02, 2018 1:41 am View latest post
No new posts Show part of geometry which intersect... aozdin General 15 Mon Mar 26, 2018 2:38 pm View latest post
No new posts Using visitor to transfer material co... wernerM General 1 Mon Jan 08, 2018 4:14 pm View latest post
No new posts Specifying indices of triangle vertic... antiro42 General 1 Thu Dec 21, 2017 12:44 pm 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