Re: [osg-users] Smooth shading

2012-10-29 Thread Sebastian Messerschmidt

Hi Geoffroy.

If you want smooth shading, why are you setting it to FLAT?

sm-setMode( osg::ShadeModel::FLAT );

should read:

sm-setMode( osg::ShadeModel::SMOOTH);



Hi,

I try to add smooth shading to my geometry but for the moment I do not have 
real success.

I use this simple code


Code:

osg::Geode *geode = new osg::Geode;
osg::Group* root = new osg::Group();

std::vectorosg::Geometry* VGeo( m_meshes.size() );
for ( size_t iObj=0; iObjm_meshes.size(); ++iObj )
{
VGeo[iObj] = CreateTriangularGeometry( m_meshes[iObj], osg::Vec4(0.0f, 1.0f, 
0.0f, 0.25f) );

// Create an array of four colors.
osg::ref_ptrosg::Vec4Array c = new osg::Vec4Array;
VGeo[iObj]-setColorArray( c.get() );
VGeo[iObj]-setColorBinding( osg::Geometry::BIND_PER_PRIMITIVE 
);
for ( size_t i=0; i m_meshes[iObj].n_faces(); ++i )
c-push_back( osg::Vec4( 1.f, 0.f, 0.f, 1.f ) );

// Create an array for the single normal.
osg::ref_ptrosg::Vec3Array n = new osg::Vec3Array;
VGeo[iObj]-setNormalArray( n.get() );
VGeo[iObj]-setNormalBinding( osg::Geometry::BIND_PER_PRIMITIVE 
);

m_meshes[iObj].request_face_normals();
m_meshes[iObj].update_face_normals ( );

OM_Mesh::FaceIter f_it;
OM_Mesh::Point N;
for ( f_it=m_meshes[iObj].faces_begin(); 
f_it!=m_meshes[iObj].faces_end(); ++f_it )
{
N = m_meshes[iObj].normal ( f_it );
n-push_back( osg::Vec3( N[0], N[1], N[2] ) );
}
geode-addDrawable( VGeo[iObj] );
}


osg::StateSet* state = geode-getOrCreateStateSet();
osg::ShadeModel* sm = new osg::ShadeModel();
sm-setMode( osg::ShadeModel::FLAT );
state-setAttribute( sm );
geode-setStateSet( state );

root-addChild( geode );







I have tried to change from flat to smooth shading but I never seen any 
difference. Is it the right way to obtain a flat shading?



Thank you!

Cheers,
Geoffroy[/code]

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





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


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


Re: [osg-users] dead locking problem of osgDB::DatabasePager::DatabaseThread under QT/linux

2012-10-29 Thread Sergey Polischuk
Hi

at first try to update osg, may be you find this problem solved.

Cheers.

27.10.2012, 17:39, Lv Qing donlvq...@msn.com:
 Hi,

 My osg2.9.11 app is working under QT/Linux.Occasionally it suffers a dead 
 lock as follows:
    #0 in _kernel_vsyscall()
    #1 in pthread_cond_wait_@@GLIBC_2.3.2 from/lib/libpthread
    #2 in Openthreads::Condition::wait from libOpenThreads
    #3 in osgDB::DatabasePager::DatabaseThread::run from libosgDB
    #4 in OpenThreads::ThreadPrivateActions::StartThread from   
 libOpenThreads
    #5 in ?? from/usr/lib/libGL.so

 The only function I use from libosgDB is just loading a osgDEM terrain 
 file,nothing else.So I think maybe  DatabasePager rendering terrian file 
 conflict about something.

 Another clue is my osg thread is integrated with other qt thread,just use 
 the AdpateWidget.cpp example.Previously,I found DatabasePager rendering 
 confilic with some QT signal.It presents just loading and runing a terrain 
 file may affect some other thread's share memory and leading some unusual 
 crash.I  solve this problem by blocking these QT signals before every fram() 
 function.

    I do not know if this two problem is relevant.I am just a 3D programmer 
 ,not so good with muti-threding programing.I know there may be nothing about 
 OSG,but I know there are so many experienced programmer in this forum can 
 help me.

    This problem is so serious,it beyond my knowledge and it may be affect my 
 career  ,so anyone give a lead may be hlepful.

 Thank you!

 Cheers,
 Lv

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

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


Re: [osg-users] how to change project matrix temporarily?;

2012-10-29 Thread Robert Osfield
Hi Shawl,

Could you explain for what purpose you need to temporarily modify the
projection matrix, this has a huge baring on how you will want to go
about it.

The OSG has an osg::Projection node that allows you to override the
project matrix for the subgraph that you attach below the Projection
Node, and the osg::Camera node that allows you to modify the
projection and view matrices, and there there is slave Camera's at the
viewer level, and finally cull callbacks that you can use to modify
the modelview and projection matrices along with many other things.
As you see there are plenty of options, which to recommend I can't say
as you haven't yet given the context of the problem you are trying to
solve.

Robert.

On 29 October 2012 00:21, wh_xiexing wh_xiex...@sina.com wrote:
 i want to implement the same effect of the following code using open scene
 graph. can it be possiable?

 public void pushProjectionOffest(Double offset)
 {
 // Modify the projection transform to shift the depth values
 slightly toward the camera in order to
 // ensure the lines are selected during depth buffering.
 GL gl = this.getGL();

 float[] pm = new float[16];
 gl.glGetFloatv(GL.GL_PROJECTION_MATRIX, pm, 0);
 pm[10] *= offset != null ? offset : 0.99; // TODO: See Lengyel 2 ed.
 Section 9.1.2 to compute optimal offset

 gl.glPushAttrib(GL.GL_TRANSFORM_BIT);
 gl.glMatrixMode(GL.GL_PROJECTION);
 gl.glPushMatrix();
 gl.glLoadMatrixf(pm, 0);
 }

  public void popProjectionOffest()
 {
 GL gl = this.getGL();

 gl.glMatrixMode(GL.GL_PROJECTION);
 gl.glPopMatrix();
 gl.glPopAttrib();
 }

 
 Shawl

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

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


Re: [osg-users] Just more 3D primitives

2012-10-29 Thread Robert Osfield
HI Andrey,

The OSG's Shape objects original purpose was to provide mathematically
defined shapes in support of physics engines.  So there isn't an
attempt to provide an exhaustive range of different types of shapes,
only the ones useful for physics engines.

For going beyond this set there is essentially an open ended list of
shapes one might want to create, so rather than chase this one simply
lets the user create an osg::Geometry the shape they require.  For
rendering purposes I generally recommend that users avoid using the
osg::Shape classes as well as the are not written to optimize
rendering performance, the render side for them is just a convenience
function.

Robert.

On 29 October 2012 04:28, Andrey Zubarev azb...@gmail.com wrote:
 Hi, all!

 In OSG we have some simple 3D primitives such as Sphere, Cylinder, etc., even 
 Capsule! But what about more primitives, for example, Torus, Torus Arc, 
 Truncated Pyramid, Truncated Cone, a Dish (half of Ellipsoid) and so on?
  I believe, all these entities could be done by hand, from the scratch. But, 
 maybe, someone knows the source of these primitives - just to avoid 
 re-inventing a bicycle?
 ...

 Thank you!

 Cheers,
 Andrey

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





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


Re: [osg-users] how to change project matrix temporarily?;

2012-10-29 Thread wh_xiexing
hi Robert osifield
i am writing an editor which can add polylines and polygons on the mesh 
model(mountains model).  the lines and polygons must follow the terrain .

so i tessellate the polylines into many parts .   because the mesh is irregular 
, unlike the GIS .   some part of the line segment is above the terrain .  
other 

other is under the terrain .so i want to put the surface shapes (polylines  
polygons ) near to the camera .   worldwind give a method as the following 

code show.but i don't know how to do that in the OSG.






Shawl

From: Robert Osfield
Date: 2012-10-29 16:30
To: OpenSceneGraph Users
Subject: Re: [osg-users] how to change project matrix temporarily?;
Hi Shawl,

Could you explain for what purpose you need to temporarily modify the
projection matrix, this has a huge baring on how you will want to go
about it.

The OSG has an osg::Projection node that allows you to override the
project matrix for the subgraph that you attach below the Projection
Node, and the osg::Camera node that allows you to modify the
projection and view matrices, and there there is slave Camera's at the
viewer level, and finally cull callbacks that you can use to modify
the modelview and projection matrices along with many other things.
As you see there are plenty of options, which to recommend I can't say
as you haven't yet given the context of the problem you are trying to
solve.

Robert.

On 29 October 2012 00:21, wh_xiexing wh_xiex...@sina.com wrote:
 i want to implement the same effect of the following code using open scene
 graph. can it be possiable?

 public void pushProjectionOffest(Double offset)
 {
 // Modify the projection transform to shift the depth values
 slightly toward the camera in order to
 // ensure the lines are selected during depth buffering.
 GL gl = this.getGL();

 float[] pm = new float[16];
 gl.glGetFloatv(GL.GL_PROJECTION_MATRIX, pm, 0);
 pm[10] *= offset != null ? offset : 0.99; // TODO: See Lengyel 2 ed.
 Section 9.1.2 to compute optimal offset

 gl.glPushAttrib(GL.GL_TRANSFORM_BIT);
 gl.glMatrixMode(GL.GL_PROJECTION);
 gl.glPushMatrix();
 gl.glLoadMatrixf(pm, 0);
 }

  public void popProjectionOffest()
 {
 GL gl = this.getGL();

 gl.glMatrixMode(GL.GL_PROJECTION);
 gl.glPopMatrix();
 gl.glPopAttrib();
 }

 
 Shawl

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

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


Re: [osg-users] [Android osgViewer] OpenGL ES context lost (how do i preserve it?)

2012-10-29 Thread Bernd Kampl
My question is: is there a way to not need to reinitialize the viewer every 
time? Is this fixable?

Cheers,
Bernd

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





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


[osg-users] 回复: Re: how to change project matrix temporarily?;

2012-10-29 Thread wh_xiexing
i implant this method into osg .   code is following:

class ocsSurfaceShape : public osg::Drawable{
public:
ocsSurfaceShape(){};
ocsSurfaceShape( const ocsSurfaceShape copy,
  const osg::CopyOp
  copyop=osg::CopyOp::SHALLOW_COPY )
 : osg::Drawable(copy, copyop) {
}

void pushProjectionOffest(double offset) const ; 

void popProjectionOffest() const;
};


void ocs::ocsSurfaceShape::pushProjectionOffest
( double offset ) const
{
float* pm = new float[16];
glGetFloatv(GL_PROJECTION_MATRIX, pm);
pm[10] *= offset != 0 ? offset : 0.99; // TODO: See Lengyel 2 ed. Section 9.1.2 
to compute optimal offset

glPushAttrib(GL_TRANSFORM_BIT);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadMatrixf(pm);
}

void ocs::ocsSurfaceShape::popProjectionOffest() const
{
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glPopAttrib();
}

//sub class of  surface Shape

class lineDrawable : public ocsSurfaceShape{
public:
lineDrawable();
lineDrawable(ocs::ocsLine line);
lineDrawable( const lineDrawable copy,
const osg::CopyOp
copyop=osg::CopyOp::SHALLOW_COPY )
: ocsSurfaceShape(copy, copyop) 
{
_line = copy._line;
}

META_Object( osg, lineDrawable);

virtual BoundingBox computeBound() const;

virtual void drawImplementation( RenderInfo renderInfo ) const;

private:
mutable ocs::ocsLine _line;
};



void ocs::lineDrawable::drawImplementation( RenderInfo renderInfo ) const
{
std::vectorocs::Vec3 list = _line.getTesselatePoints();
ocsAttributes attr = _line.getAttribute();
float color[4];
attr.getColor(color);
osg::GLBeginEndAdapter gl =
renderInfo.getState()-getGLBeginEndAdapter();
gl.Color4f(color[0],color[1],color[2],color[3]);
pushProjectionOffest(0.95);//change the 
project matrix here 
gl.Begin(GL_LINE_STRIP);
   for (unsigned int u = 0; u  list.size(); u++){
   gl.Vertex3f(list[u].x(),list[u].y(),list[u].z());
   }
gl.End();
popProjectionOffest();//restore it 
}

does it the best way?   it's wierd that sometims the line is  disappeared.   
other question is  the GL API 

glPushAttrib(GL_TRANSFORM_BIT);  in pushProjectionOffest is identical to 
calling 

osg::GLBeginEndAdapter gl 's method ?




Shawl

发件人: wh_xiexing
发送时间: 2012-10-29 16:50
收件人: osg-users
主题: Re: [osg-users] how to change project matrix temporarily?;
hi Robert osifield
i am writing an editor which can add polylines and polygons on the mesh 
model(mountains model).  the lines and polygons must follow the terrain .

so i tessellate the polylines into many parts .   because the mesh is irregular 
, unlike the GIS .   some part of the line segment is above the terrain .  
other 

other is under the terrain .so i want to put the surface shapes (polylines  
polygons ) near to the camera .   worldwind give a method as the following 

code show.but i don't know how to do that in the OSG.






Shawl

From: Robert Osfield
Date: 2012-10-29 16:30
To: OpenSceneGraph Users
Subject: Re: [osg-users] how to change project matrix temporarily?;
Hi Shawl,

Could you explain for what purpose you need to temporarily modify the
projection matrix, this has a huge baring on how you will want to go
about it.

The OSG has an osg::Projection node that allows you to override the
project matrix for the subgraph that you attach below the Projection
Node, and the osg::Camera node that allows you to modify the
projection and view matrices, and there there is slave Camera's at the
viewer level, and finally cull callbacks that you can use to modify
the modelview and projection matrices along with many other things.
As you see there are plenty of options, which to recommend I can't say
as you haven't yet given the context of the problem you are trying to
solve.

Robert.

On 29 October 2012 00:21, wh_xiexing wh_xiex...@sina.com wrote:
 i want to implement the same effect of the following code using open scene
 graph. can it be possiable?

 public void pushProjectionOffest(Double offset)
 {
 // Modify the projection transform to shift the depth values
 slightly toward the camera in order to
 // ensure the lines are selected during depth buffering.
 GL gl = this.getGL();

 float[] pm = new float[16];
 gl.glGetFloatv(GL.GL_PROJECTION_MATRIX, pm, 0);
 pm[10] *= offset != null ? offset : 0.99; // TODO: See Lengyel 2 ed.
 Section 9.1.2 to compute optimal offset

 gl.glPushAttrib(GL.GL_TRANSFORM_BIT);
 gl.glMatrixMode(GL.GL_PROJECTION);
 gl.glPushMatrix();
 gl.glLoadMatrixf(pm, 0);
 }

  public void popProjectionOffest()
 {
 GL gl = this.getGL();

 gl.glMatrixMode(GL.GL_PROJECTION);
 gl.glPopMatrix();
 gl.glPopAttrib();
 }

 
 Shawl

 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 

Re: [osg-users] dead locking problem of osgDB::DatabasePager::DatabaseThread under QT/linux

2012-10-29 Thread Lv Qing

hybr wrote:
 Hi
 
 at first try to update osg, may be you find this problem solved.
 
 Cheers.
 
 27.10.2012, 17:39, Lv Qing :
 
  Hi,
  
  My osg2.9.11 app is working under QT/Linux.Occasionally it suffers a dead 
  lock as follows:
     #0 in _kernel_vsyscall()
     #1 in pthread_cond_wait_@@GLIBC_2.3.2 from/lib/libpthread
     #2 in Openthreads::Condition::wait from libOpenThreads
     #3 in osgDB::DatabasePager::DatabaseThread::run from libosgDB
     #4 in OpenThreads::ThreadPrivateActions::StartThread from   
  libOpenThreads
     #5 in ?? from/usr/lib/libGL.so
  
  The only function I use from libosgDB is just loading a osgDEM terrain 
  file,nothing else.So I think maybe  DatabasePager rendering terrian file 
  conflict about something.
  
  Another clue is my osg thread is integrated with other qt thread,just 
  use the AdpateWidget.cpp example.Previously,I found DatabasePager rendering 
  confilic with some QT signal.It presents just loading and runing a terrain 
  file may affect some other thread's share memory and leading some unusual 
  crash.I  solve this problem by blocking these QT signals before every 
  fram() function.
  
     I do not know if this two problem is relevant.I am just a 3D programmer 
  ,not so good with muti-threding programing.I know there may be nothing 
  about OSG,but I know there are so many experienced programmer in this forum 
  can help me.
  
     This problem is so serious,it beyond my knowledge and it may be affect 
  my career  ,so anyone give a lead may be hlepful.
  
  Thank you!
  
  Cheers,
  Lv
  
  --
  Read this topic online here:
  http://forum.openscenegraph.org/viewtopic.php?p=50829#50829
  
  ___
  osg-users mailing list
  
  http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
  
 ___
 osg-users mailing list
 
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 
  --
 Post generated by Mail2Forum


ThX for your reply!

I update 2.9.16 ,same problem!Not ready for osg3.0 ,too much change.

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





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


Re: [osg-users] dead locking problem of osgDB::DatabasePager::DatabaseThread under QT/linux

2012-10-29 Thread Robert Osfield
HI Lv,

On 29 October 2012 10:16, Lv Qing donlvq...@msn.com wrote:
 I update 2.9.16 ,same problem!Not ready for osg3.0 ,too much change.

3.x might not address the problem you have, as it's likely down to
some peculiarity of  how the custom threading is behaving, but I would
certainly recommend moving the 3.0.x.  2.9.16 is a developer version
and won't contain all the fixes and improvements available in 3.0.x.
The API changes between the two versions should be pretty minor, given
that it could fix bugs I would say that spending time upgrading to a
stable release would be much better than trying to get by with a
unsupported developer release.

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


Re: [osg-users] dead locking problem of osgDB::DatabasePager::DatabaseThread under QT/linux

2012-10-29 Thread Lv Qing

robertosfield wrote:
 HI Lv,
 
 On 29 October 2012 10:16, Lv Qing  wrote:
 
  I update 2.9.16 ,same problem!Not ready for osg3.0 ,too much change.
  
 
 3.x might not address the problem you have, as it's likely down to
 some peculiarity of  how the custom threading is behaving, but I would
 certainly recommend moving the 3.0.x.  2.9.16 is a developer version
 and won't contain all the fixes and improvements available in 3.0.x.
 The API changes between the two versions should be pretty minor, given
 that it could fix bugs I would say that spending time upgrading to a
 stable release would be much better than trying to get by with a
 unsupported developer release.
 
 Robert.
 ___
 osg-users mailing list
 
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 
  --
 Post generated by Mail2Forum


I will try ,Thx!

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





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


[osg-users] Streaming world and integer limitations

2012-10-29 Thread Dmitry K.
Hi,

I'm thinking about how to do a streaming world in OSG and I have noticed one 
problem at first.

We have scene graph node position - 32 bit integer. We walk through terrain 
meeting some trees, houses while sectors ahead are loading on a background and 
then the position of a player and 3d objects becomes maximum integer value. 
What then? I don't know.

What I are regular methods to avoid such limitations?

Maybe I should reset position to relative value in each sector?

Thank you!

Cheers,
Dmitry

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





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


Re: [osg-users] Smooth shading

2012-10-29 Thread Geoffroy Rivet-Sabourin
Hi,

you are right. In the code it is set to flat but I have also tried to set to 
SMOOTH but I never see difference between results. With the smooth setting I 
still see the face edges
... 

Thank you!

Cheers,
Geoffroy

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





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


Re: [osg-users] Smooth shading

2012-10-29 Thread Sebastian Messerschmidt

In order to get correct shading results, you have to create correct normals.
There is also a smoothing visitor which you could try:

osgUtil::SmoothingVisitor sm;
 model-accept(sm);

cheers
Sebastian

Hi,

you are right. In the code it is set to flat but I have also tried to set to 
SMOOTH but I never see difference between results. With the smooth setting I 
still see the face edges
...

Thank you!

Cheers,
Geoffroy

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





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


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


Re: [osg-users] Uniform arrays not working for me using Visual Studio 2010

2012-10-29 Thread David Sellin
Version 3.1.3 worked! Thank you everyone for your help.

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





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


Re: [osg-users] Smooth shading

2012-10-29 Thread Geoffroy Rivet-Sabourin
Is this method is efficient ( computation time ) or is it a better avenue to 
use a GLSL frag and vertex shader

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





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


Re: [osg-users] Projective Multi-Texturing

2012-10-29 Thread Jason Daly

On 10/27/2012 02:09 AM, Christoph Heindl wrote:


This sounds like a clever idea, but I have to keep exporting the mesh 
in mind. When exporting I think I should have the UV coordinates ready 
on the CPU. Is there a way to transmit the output of the shader (i.e 
vertex ST coordinates) back to the CPU?


You can do this with transform feedback.  I'm not sure how good OSG's 
support for this feature is, though.


--J

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


[osg-users] screen capture with Qt

2012-10-29 Thread Gianni Ambrosio
Hi All,
I basically merged osgscenecapture example and osgviewerQt to implement  a 
spike solution with a scene capture functionality in a Qt application. 
Unfortunately the resulting image (bmp) is black except for the case that does 
not use glReadPixels(). The osgscenecapture example itself is working fine. So, 
maybe there's something behind the scene I don't understand. Can anybody please 
help me?

Regards,
Gianni

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





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


Re: [osg-users] Just more 3D primitives

2012-10-29 Thread Paul Martz
I'm definitely open to having such code contributed to osgWorks, where they 
would be Geometry-based rather than ShapeDrawable-based.

   -Paul


On 10/28/2012 10:28 PM, Andrey Zubarev wrote:

Hi, all!

In OSG we have some simple 3D primitives such as Sphere, Cylinder, etc., even 
Capsule! But what about more primitives, for example, Torus, Torus Arc, 
Truncated Pyramid, Truncated Cone, a Dish (half of Ellipsoid) and so on?
  I believe, all these entities could be done by hand, from the scratch. But, 
maybe, someone knows the source of these primitives - just to avoid 
re-inventing a bicycle?
...

Thank you!

Cheers,
Andrey

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





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



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


Re: [osg-users] Streaming world and integer limitations

2012-10-29 Thread Chris Hanson
 Mon, Oct 29, 2012 at 5:24 AM, Dmitry K. zzfi...@hotbox.ru wrote:

 We have scene graph node position - 32 bit integer. We walk through
 terrain meeting some trees, houses while sectors ahead are loading on a
 background and then the position of a player and 3d objects becomes maximum
 integer value. What then? I don't know.
 What I are regular methods to avoid such limitations?
 Maybe I should reset position to relative value in each sector?


  What exactly are you saying is a 32-bit integer? I'm not aware of any
32-bit int limitation in OSG.


-- 
Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com
http://www.alphapixel.com/
Training • Consulting • Contracting
3D • Scene Graphs (Open Scene Graph/OSG) • OpenGL 2 • OpenGL 3 • OpenGL 4 •
GLSL • OpenGL ES 1 • OpenGL ES 2 • OpenCL
Digital Imaging • GIS • GPS • Telemetry • Cryptography • Digital Audio •
LIDAR • Kinect • Embedded • Mobile • iPhone/iPad/iOS • Android
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] screen capture with Qt

2012-10-29 Thread Robert Osfield
Hi Gianni,

I know nothing about your specific implementation, the only thing I
can suggest is the general comment is that OpenGL has the concept of
current draw and read buffers, when you do a glReadPixels() you should
make sure that the read buffer is the same as the scene was rendered
to i.e. the draw buffer.  osg::Camera has support for setting the
(gl)ReadBuffer and (gl)DrawBuffer, normally these would be set to
GL_BACK when the window is double buffered.

Robert.

On 29 October 2012 14:42, Gianni Ambrosio ga...@vi-grade.com wrote:
 Hi All,
 I basically merged osgscenecapture example and osgviewerQt to implement  a 
 spike solution with a scene capture functionality in a Qt application. 
 Unfortunately the resulting image (bmp) is black except for the case that 
 does not use glReadPixels(). The osgscenecapture example itself is working 
 fine. So, maybe there's something behind the scene I don't understand. Can 
 anybody please help me?

 Regards,
 Gianni

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





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


[osg-users] Rotate and translate camera

2012-10-29 Thread Rick Schwantes
Hi all,

I have a hopefully simple question. I'm setting up an app that will
manually adjust the camera with each frame, no camera manipulators are used.

With each adjustment I want to increment the translation and rotation of
the camera.  The translation works, but the camera rotation seems to be
around a point far away (origin?).  How can I make the camera rotate or
spin around its current position?  Is there an example somewhere I could
look at?

osg::Matrixd cameraRotation,
  newRotation,
  cameraTranslation,
  finalPosition;
osg::Matrixd viewMatrix = viewer.getCamera()-getViewMatrix();

cameraRotation.setRotate(viewMatrix.getRotate());
newRotation.makeRotate(osg::DegreesToRadians(0.0f), osg::Vec3d(1.0, 0.0,
0.0),
  osg::DegreesToRadians(2.0), osg::Vec3d(0.0, 1.0, 0.0),
  osg::DegreesToRadians(0.0f), osg::Vec3d(0.0, 0.0, 1.0));
cameraRotation = cameraRotation * newRotation;
cameraTranslation.setTrans(viewMatrix.getTrans());
newTranslation.makeTranslate(osg::Vec3f(2.0, 0.0, 0.0));
cameraTranslation = cameraTranslation * newTranslation;
finalPosition = cameraRotation * cameraTranslation;
viewer.getCamera()-setViewMatrix(finalPosition);

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


Re: [osg-users] screen capture with Qt

2012-10-29 Thread Gianni Ambrosio
Thank you Robert for the fast reply.
In the meanwhile I'm attaching the code.

Regards,
Gianni

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




Attachments: 
http://forum.openscenegraph.org//files/scenecaptureqt_189.cpp


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


Re: [osg-users] Smooth shading

2012-10-29 Thread Sebastian Messerschmidt

Am 29.10.2012 15:38, schrieb Geoffroy Rivet-Sabourin:

Is this method is efficient ( computation time ) or is it a better avenue to 
use a GLSL frag and vertex shader
What do you mean? It might be as well a O(n) algorithm, but as long as 
you do not try if it is suitable for you, you should not question 
performance.
Have you tried it? Usually you run the visitor once per loaded/created 
model.
You cannot simply do this in the vertex shader as you don't have any 
information about the topology there.


I'd stick to simply try and measure it.
Another option if you are creating your geometry on your own would be to 
create correct normals in the first place.


cheers
Sebastian



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





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


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


[osg-users] FBX separate animations

2012-10-29 Thread Sebastian Messerschmidt

Hello,

I've got the FBX plugin working and trying various models.
Unfortunately for me, most FBX models are separated into the model 
itself and external animations.
I simply have no clue how to load the animations and use them with the 
model.

Can someone help me out here?

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


Re: [osg-users] [Android osgViewer] OpenGL ES context lost (how do i preserve it?)

2012-10-29 Thread Jorge Izquierdo Ciges
Yes, it is possible, as I wrote in the docs you only have to modify the
functionality. That functionality was not included in the example because
there were more pending issues.

2012/10/29 Bernd Kampl bernd.ka...@gmail.com

 My question is: is there a way to not need to reinitialize the viewer
 every time? Is this fixable?

 Cheers,
 Bernd

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





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

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


Re: [osg-users] Smooth shading

2012-10-29 Thread Geoffroy Rivet-Sabourin
it works perfectly 

Thank you

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





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