Hi Stuart,

> De: Stuart Buchanan
> 
> On Wed, May 23, 2012 at 2:38 PM, Björn Kesten wrote:
> > Would trimming down building variety help?
> 
> Unfortunately not.  Individual buildings aren't instantiations
> of a small number of objects, as the random vegetation is.
> 
> Instead, a huge group of buildings are a single OSG object,
> which limits the OSG overhead and means they are very
> efficient to render.

There is an OpenGL feature that is available in OSG : you can instantiate the 
same geometry multiple times. You prepare the geometry once and when adding the 
primitive set (IIRC) you specify an optional number of instances. The vertex 
shader is call the number of instance specified times with a predefined uniform 
gl_InstanceID set from 1 to n. Of course, as you don't want your geometry draw 
n times at the same place, you have to compute the placement of objects inside 
the vertex shader using gl_InstanceID. Either you compute placement with an 
algorithm inside the shader, or you provide a matrix array uniform that you can 
index with gl_InstanceID.

see http://www.opengl.org/wiki/Vertex_Specification#Instancing for a less 
nebulous explanation ;)

Regards,
-Fred

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to