Re: [osg-users] Manipulating a loaded 3D model

2012-06-24 Thread Robert Osfield
Hi Praveena,

Create a static cylindrical geometry and decorate this subgrpah with a
transform node that you update dynamically to align the cylinder with the
points your want.

Robert.

On 24 June 2012 07:45, Praveena Sarathchandra pravee...@gmail.com wrote:

 Hi,

 I want to have 2 points in 3D space and use their coordinates to
 align/scale a 3D cylinder model. Thus the cylinder should have a dynamic
 length that will be updated each time the points are moved. Illustration
 below:
 [image: Inline image 1]
 How to achieve this in OSG?

 Thanks

 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


image.png___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Strange error with multiple textures in a state set

2012-06-24 Thread Joel Graff
Hello,

I've been playing with multi-texturing and have encountered a situation where I 
get a vector subscript out of range error.  Typically, it's easy to spot the 
cause of this, but this one has me a bit stumped.

I've boiled down the problem to what appears to be an issue with converting 
geometry tex coord arrays to vertex attributes using the osgBuiltIn code.  That 
is, if I specify more than five tex coord arrays for a geometry object, the osg 
built-in vertex attribute conversion code seems to have issues.

For reference, here's the function to enable osg built-in's:

Code:

void enableOsgBuiltIns( osgViewer::Viewer viewer )
{

// switch on the FnUniforms that track the modelview and projection 
matrices
osgViewer::Viewer::Windows windows;
viewer.getWindows(windows);
for(osgViewer::Viewer::Windows::iterator itr = windows.begin(); itr != 
windows.end(); ++itr)
{
(*itr)-getState()-setUseModelViewAndProjectionUniforms(true);
(*itr)-getState()-setUseVertexAttributeAliasing(true);
}
};




Next is my code which adds textures to an existing geometry object:


Code:

void RenderStage::addInputTexture ( osg::Texture2D* tex, const std::string 
texName =  )
{
osg::StateSet* ss = this-getOrCreateStateSet();

int textureCount = ss-getNumTextureAttributeLists();

ss-setTextureAttributeAndModes( textureCount, tex );

if( usingRttQuad_ )
{
osg::Geometry* geom = 
geometry_-asGeode()-getDrawable(0)-asGeometry();
geom-setTexCoordArray( textureCount, geom-getTexCoordArray(0) 
);
}
};




The quad code is:


Code:

osg::Geode* RenderStage::createRttQuad()
{
osg::ref_ptrosg::Vec3Array quad_coords = new osg::Vec3Array; // vertex 
coords
// counter-clockwise
quad_coords-push_back(osg::Vec3d(0, 0, -1));
quad_coords-push_back(osg::Vec3d(1, 0, -1));
quad_coords-push_back(osg::Vec3d(1, 1, -1));
quad_coords-push_back(osg::Vec3d(0, 1, -1));

osg::ref_ptrosg::Vec2Array quad_tcoords = new osg::Vec2Array; // texture 
coords
quad_tcoords-push_back(osg::Vec2(0, 0));
quad_tcoords-push_back(osg::Vec2(1, 0));
quad_tcoords-push_back(osg::Vec2(1, 1));
quad_tcoords-push_back(osg::Vec2(0, 1));

osg::Geometry* quad_geom = new osg::Geometry;
quad_geom-setVertexArray(quad_coords.get());

osg::ref_ptrosg::DrawArrays quad_da = new 
osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4);

quad_geom-setTexCoordArray(0, quad_tcoords.get());

quad_geom-addPrimitiveSet(quad_da.get());

osg::Geode* node = new osg::Geode;
node-addDrawable( quad_geom) ;

return node;
};




So here's what I've observed:

1.  If I do not enable OSG builtin's, I have no error.
2. With built-in's enabled, I can eliminate the error if I comment out the 
following line in my addInputTexture() fuunction:


Code:

geom-setTexCoordArray( textureCount, geom-getTexCoordArray(0) );




The reason this line is there is because I'm using an RTT camera and, 
naturally, wish to use the same quad geometry for multiple textures.  Of 
course, for each new texture, I also assign texture coordinates to the 
corresponding unit, which is just a copy of the original texture coordinate 
array pointer.  Perhaps that approach is wrong, but it escapes me as to why it 
appears to work fine up to tex unit four.

Granted, I could just reference the unit 0 tex coord array for all textures, 
but now that this inexplicable error has appeared, I am worried there may be 
more going on that I need to understand.  Given that the gl_MultiTexCoord 
built-in has indices ranging from 0 to 8, I am confused as to why the 
osgBuiltIn's code appears to choke on texture coords assigned to units over 4...

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=48461#48461





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Antialiasing in Volume rendering

2012-06-24 Thread Clement.Chu
Hi,

   I got aliasing problem on volume rendering.  I tried to set parameter 
samples to 8 in class osg::GraphicsContext::Traits, but I still can see 
aliasing.  Does anyone have an solution to stop aliasing.  Thanks.


Regards,
Clement
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] ECEF to openGl

2012-06-24 Thread Pilip Rogati
will look into this and probably post back with new problems

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=48458#48458





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Parallel Rendering Problems using NVidia GPU cards in Windows

2012-06-24 Thread GeeKer Wang
Hi, all

I want to use two GTS 250 cards to do the parallel rendering job based on
OpenSceneGraph。

In my experiment, a scene full of complex models is split to 2 parts
according to viewport。
The 2 parts are rendered in seperated windows (actually two slaves).
I hope the LEFT part is rendered in the first screen and by the first GPU,
and the RIGHT part in the second screen and by the second GPU。
The results are a little wierd and disappointing.

Experiment condition:
GigaByte Motherboard EX58-UD3R, 2 GTS 250 Cards, Windows XP, driver 285.58
gpuz are used to monitor the GPUs.
There are 3 SLI options: Maximize 3D performance, Activate all displays,
Disable SLI

CASE 1: 1 screen and 1 GPU, 1 window
Frame Rate: 8.4
GPU Load: 100%

CASE 2: 2 screens and 2 GPU, 2 windows, the scene are split
Frame Rate: 3.5
GPU1 Load: 60%
GPU2 Load: 60%

CASE 3: 2 screens and 2 GPU, 1 window in 1st screen
Frame Rate: 8.4, 14 if only half of the scene is rendered
GPU1 Load: 100%
GPU2 Load: 100%

CASE 1,2,3 are the same for Activate all displays and Disable SLI mode。
When I use Maximize 3D performance mode, and use the SLI connector to
connect the 2 GPU cards, there is only 1 screen left。
But according to the gpuz, only 1 GPU is working。

CASE 4: 1 screen and 2 GPUs, 1 window
Frame Rate: 8.4
GPU1 Load: 100%
GPU2 Load: 0%

CASE 5: 1 screen and 2 GPUs, 2 window
Frame Rate: 3.5
GPU1 Load: 60%
GPU2 Load: 0%


My assumption that 2 GPUs can work independently seems not right.
And the SLI is also not working。
It looks like there is always only 1 GPU working, even the other GPU is
full of load。

So my problem is:
1. In windows, how can I let the 2 GPUs work independently and bind the
screen with the GPU.
2. Why the SLI mode seems failed? Are there some special configurations?

Any advice will be appreciated!

-- 
Bob
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org