[OpendTect_Developers] Make your own geometry display in the scene

Yuancheng Liu yuancheng.liu at dgbes.com
Mon Jul 25 19:00:44 CEST 2011


Dear all,

if you want to make your own display object in the OpendTect scene 
beyond what we have in the od tree,  here I am going to give you a 
sketch on how to make it  in the OpendTect scene. Basically, there are 
two important steps here, one is making the shape of the object, another 
one is optional, use it only when you want to have your data displayed 
on the shape.

In visBase, we have a class called Shape, but most time, we use the 
inherited class IndexedShape. Basically, you have to give your object 
position coordinates to it and then set the indexes of the connections 
among those positions. The most commonly used shapes are: 
visBase::TriangleStripSet,  visBase::IndexedPolyLine, 
visBase::IndexedPointSet. For example, all the faults and all the 
horizons and geometry bodies are based on them and you could use them on 
most of the cases. Of course, beyond the Shape class, we also have some 
other  display shapes for inline/crossline/z slice and 2D lines. 

To make the shape, the object geometry positions are the first thing you 
might want to  set, and they could be shared by the object 
shapes(points, lines, or triangles). After setting the positions, you 
could now make the shape, either do triangulation or any kind depend on 
how you want to make the shape, just add  the position index to connect 
if you already set the coordinate and use index -1 to separate each 
connected shape. For example, if you have a row-column data,  
tessellation will work fine for the shape, you could use the class in 
Geometry/arraytesselator.h to do the work.

To display your data on the shape, visBase::TextureChannels is a very 
handy class to use, basically you set up the data size of each dimension 
on your object and then dump the data to it, just make sure the order of 
your data should match with your shape. The data size it could handle 
would depends on your graphics card. Of course, there are more advanced 
display settings from this class too. When use this class, you should 
also include the TextureComposer, since it picks up the image you set in 
the channels and sends parts of it to  your graphics card.

For detailed code examples,  you might want to check  the horizon display.

/mClass visMyObjectDisplay :      public visBase::VisualObjectImpl
{
     **************************
     visBase::Coordinates                coords_;  ///Set coordinate for 
each position you want to use/
     visBase::Normals                      normals_;  ///Optional/

     visBase::IndexedPolyLine        lines_;
     visBase::TriangleStripSet         triangles_; ///Make connections 
between positions/
                                                      
     visBase::TextureChannels        texturechannels_;   / //Set the 
size of your object and put data on it/
     visBase::TextureComposer      texturecomposers_; ///Set display 
origin and display size of each dimension/
}/

After making all these, you could use uiVisPartServer::addObject to add 
the visMyObjectDisplay to your scene. That's it,  have fun to play 
around with it.


Happy coding,

Yuancheng

-- 


-- dGB Earth Sciences
-- 1 Sugar Creek Center BLVD #935
-- Sugar Land, TX 77478; USA
-- Tel: +1 281-240-3939, Fax: +1 281-240-3944
-- (Skype) +1 281-968-0464






More information about the Developers mailing list