Re: [osg-users] iOS & GLES2 : VERTEX glCompileShader "" FAILED

2014-11-10 Thread Liu Xiao
Thanks ! That is really a simple and nice example for me, I will try it and 
feedback when I get succeed. 

I think your solution is loading texture separatly , while my osg file is 
binding with texture. I donot know how to convert fbx to osg format for 
external texture file.

However, the following shader works for my young.osg file here :


Code:
static const char gVertexShader1[] =
"varying vec2 v_texCoord; \n"
"void main() {  \n"
"gl_Position  = gl_ModelViewProjectionMatrix * gl_Vertex;   \n"
" v_texCoord   = gl_MultiTexCoord0.xy;  
  \n"
"}  \n";

static const char gFragmentShader1[] =
"varying  mediump vec2 v_texCoord;  
\n"
"uniform sampler2D sam; 
   \n"
"void main() {  
  \n"
"gl_FragColor = texture2D(sam, v_texCoord); 
   \n"
"}   






Sergey Kurdakov wrote:
> Hi Liu,
> 
> 
> consider this simple pseudo code example ( just fix 
> createTexturedQuadGeometry in code below so that it has #if 
> defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) line instead of
> #if defined(OSG_GLES1_AVAILABLE) || !defined(OSG_GLES2_AVAILABLE) ) )
> 
> 
> have u_Texture sampler in your shader
> 
> uniform sampler2D u_Texture;
> 
> 
> then create geode 
> 
>     osg::Geode*   geode   = new osg::Geode();
>     osg::Program* program = new osg::Program();
> 
>     osg::Shader*  vert    = new osg::Shader(osg::Shader::VERTEX, 
> gVertexShader);
>     osg::Shader*  frag    =  new osg::Shader(osg::Shader::FRAGMENT, 
> gFragmentShader );
> 
>     program->addShader(vert);
>     program->addShader(frag);
>     geode->addDrawable(makePlain ());
>     osg::StateSet* pStateSet = geode->getOrCreateStateSet(); 
> 
>  
>     osg::Image* pImage = new osg::Image;
> 
> 
> load image here, now
>  
>     osg::Texture2D* pTex = new osg::Texture2D();
>     pTex->setFilter( pTex->MIN_FILTER,pTex->LINEAR);
>     pTex->setFilter( pTex->MAG_FILTER,pTex->LINEAR);
>     pTex->setImage(0,  pImage);    
>         
> 
> 
>     pStateSet->setTextureAttribute( 0, pTex, osg::StateAttribute::ON );
>      
>     pStateSet->addUniform(new osg::Uniform("u_Texture", 0)); 
> 
>     pStateSet->setAttribute(program);
> 
> 
> makePlain could be as following:
> 
> 
> osg::Geometry*
> makePlain()
> {
> 
>     osg::ref_ptr geom= osg::createTexturedQuadGeometry( 
> osg::Vec3(-0.5f, 0.0f,-0.5f),
>                                                                       
> osg::Vec3(1.0f,0.0f,0.0f),
>                                                                       
> osg::Vec3(0.0f,0.0f,1.0f) );
> 
>     if( geom == NULL )
>     geom = new osg::Geometry;
> 
>     geom->setUseVertexBufferObjects(true); 
> 
>     return( geom.release() );
> }
> 
> 
> this simple example should work, then you should move further.
> 
> Regards
> Sergey
> 
> 
> 
> On Fri, Nov 7, 2014 at 3:56 PM, Liu Xiao < ()> wrote:
> 
> > Thanks so much for your quick reply , it really helps.
> > 
> > Also this post gives me a good example of shader:
> > http://forum.openscenegraph.org/viewtopic.php?t=6482 
> > (http://forum.openscenegraph.org/viewtopic.php?t=6482)
> > 
> > But still I have problem on drawing the texture.
> > 
> > 
> > Sergey Kurdakov wrote:
> > 
> > > Hi Liu,
> > > 
> > > 
> > > use setUseVertexAttributeAliasing as Robert recently explained for 
> > > similar question
> > > 
> > > ===
> > > The aliasing of gl_* uniforms to osg_* equivialants is not done by 
> > > default.  You can switch it one yourself if required though via 
> > > osg::State, from the osgsimplegl3 example:
> > > 
> > >     // for non GL3/GL4 and non GLES2 platforms we need enable the osg_ 
> > > uniforms that the shaders will use,
> > >     // you don't need thse two lines on GL3/GL4 and GLES2 specific builds 
> > > as these will be enable by default.
> > >     gc->getState()->setUseModelViewAndProjectionUniforms(true);
> > >     gc->getState()->setUseVertexAttributeAliasing(true);
> > > 
> > > 
> > > In your own shaders if you are building against GL1/2 (default build of 
> > > OSG) then you can simply use the gl_* parameters.
> > > 
> > > Also have a look at the shaders in OpenSceneGraph-Data and the osgshaders 
> > > example.
> > > ===
> > > 
> > > 
> > > 
> > > 
> > > Regards
> > > Sergey
> > > 
> > > On Fri, Nov 7, 2014 at 12:14 PM, Liu Xiao < ()> wrote:
> > > 
> > > 
> > > > Hi,
> > > > 
> > > > When I trying to use the osg 3.2.1 (with OSG_GLES2_AVAILABLE:BOOL=ON ) 
> 

Re: [osg-users] iOS & GLES2 : VERTEX glCompileShader "" FAILED

2014-11-10 Thread Liu Xiao
Thanks ! That is really a simple and nice example for me, I will try it and 
feedback when I get succeed. 

I think your solution is loading texture separatly , while my osg file is 
binding with texture. I donot know how to convert fbx to osg format for 
external texture file.

However, the following shader works for my young.osg file here :


Code:
static const char gVertexShader1[] =
"varying vec2 v_texCoord; \n"
"void main() {  \n"
"gl_Position  = gl_ModelViewProjectionMatrix * gl_Vertex;   \n"
" v_texCoord   = gl_MultiTexCoord0.xy;  
  \n"
"}  \n";

static const char gFragmentShader1[] =
"varying  mediump vec2 v_texCoord;  
\n"
"uniform sampler2D sam; 
   \n"
"void main() {  
  \n"
"gl_FragColor = texture2D(sam, v_texCoord); 
   \n"
"}   






Sergey Kurdakov wrote:
> Hi Liu,
> 
> 
> consider this simple pseudo code example ( just fix 
> createTexturedQuadGeometry in code below so that it has #if 
> defined(OSG_GLES1_AVAILABLE) || defined(OSG_GLES2_AVAILABLE) line instead of
> #if defined(OSG_GLES1_AVAILABLE) || !defined(OSG_GLES2_AVAILABLE) ) )
> 
> 
> have u_Texture sampler in your shader
> 
> uniform sampler2D u_Texture;
> 
> 
> then create geode 
> 
>     osg::Geode*   geode   = new osg::Geode();
>     osg::Program* program = new osg::Program();
> 
>     osg::Shader*  vert    = new osg::Shader(osg::Shader::VERTEX, 
> gVertexShader);
>     osg::Shader*  frag    =  new osg::Shader(osg::Shader::FRAGMENT, 
> gFragmentShader );
> 
>     program->addShader(vert);
>     program->addShader(frag);
>     geode->addDrawable(makePlain ());
>     osg::StateSet* pStateSet = geode->getOrCreateStateSet(); 
> 
>  
>     osg::Image* pImage = new osg::Image;
> 
> 
> load image here, now
>  
>     osg::Texture2D* pTex = new osg::Texture2D();
>     pTex->setFilter( pTex->MIN_FILTER,pTex->LINEAR);
>     pTex->setFilter( pTex->MAG_FILTER,pTex->LINEAR);
>     pTex->setImage(0,  pImage);    
>         
> 
> 
>     pStateSet->setTextureAttribute( 0, pTex, osg::StateAttribute::ON );
>      
>     pStateSet->addUniform(new osg::Uniform("u_Texture", 0)); 
> 
>     pStateSet->setAttribute(program);
> 
> 
> makePlain could be as following:
> 
> 
> osg::Geometry*
> makePlain()
> {
> 
>     osg::ref_ptr geom= osg::createTexturedQuadGeometry( 
> osg::Vec3(-0.5f, 0.0f,-0.5f),
>                                                                       
> osg::Vec3(1.0f,0.0f,0.0f),
>                                                                       
> osg::Vec3(0.0f,0.0f,1.0f) );
> 
>     if( geom == NULL )
>     geom = new osg::Geometry;
> 
>     geom->setUseVertexBufferObjects(true); 
> 
>     return( geom.release() );
> }
> 
> 
> this simple example should work, then you should move further.
> 
> Regards
> Sergey
> 
> 
> 
> On Fri, Nov 7, 2014 at 3:56 PM, Liu Xiao < ()> wrote:
> 
> > Thanks so much for your quick reply , it really helps.
> > 
> > Also this post gives me a good example of shader:
> > http://forum.openscenegraph.org/viewtopic.php?t=6482 
> > (http://forum.openscenegraph.org/viewtopic.php?t=6482)
> > 
> > But still I have problem on drawing the texture.
> > 
> > 
> > Sergey Kurdakov wrote:
> > 
> > > Hi Liu,
> > > 
> > > 
> > > use setUseVertexAttributeAliasing as Robert recently explained for 
> > > similar question
> > > 
> > > ===
> > > The aliasing of gl_* uniforms to osg_* equivialants is not done by 
> > > default.  You can switch it one yourself if required though via 
> > > osg::State, from the osgsimplegl3 example:
> > > 
> > >     // for non GL3/GL4 and non GLES2 platforms we need enable the osg_ 
> > > uniforms that the shaders will use,
> > >     // you don't need thse two lines on GL3/GL4 and GLES2 specific builds 
> > > as these will be enable by default.
> > >     gc->getState()->setUseModelViewAndProjectionUniforms(true);
> > >     gc->getState()->setUseVertexAttributeAliasing(true);
> > > 
> > > 
> > > In your own shaders if you are building against GL1/2 (default build of 
> > > OSG) then you can simply use the gl_* parameters.
> > > 
> > > Also have a look at the shaders in OpenSceneGraph-Data and the osgshaders 
> > > example.
> > > ===
> > > 
> > > 
> > > 
> > > 
> > > Regards
> > > Sergey
> > > 
> > > On Fri, Nov 7, 2014 at 12:14 PM, Liu Xiao < ()> wrote:
> > > 
> > > 
> > > > Hi,
> > > > 
> > > > When I trying to use the osg 3.2.1 (with OSG_GLES2_AVAILABLE:BOOL=ON ) 
> 

Re: [osg-users] iOS & GLES2 : VERTEX glCompileShader "" FAILED

2014-11-10 Thread Sergey Kurdakov
Hi Liu,

as you already indicated in other posts - you have read my advice to other
people in this situation
And here I repeat it use Cedrik Pinson osgjs format ( exporter for osg
converter  is here
https://github.com/cedricpinson/osg/tree/master/src/osgPlugins/osgjs ) it
looks very suitable for  OpenGL ES 2.0 models. To use it, though, you will
need to write your own loader


Regards
Sergey

On Mon, Nov 10, 2014 at 1:23 PM, Liu Xiao  wrote:

> Thanks ! That is really a simple and nice example for me, I will try it
> and feedback when I get succeed.
>
> I think your solution is loading texture separatly , while my osg file is
> binding with texture. I donot know how to convert fbx to osg format for
> external texture file.
>
> However, the following shader works for my young.osg file here :
>
>
> Code:
> static const char gVertexShader1[] =
> "varying vec2 v_texCoord; \n"
> "void main() {
>   \n"
> "gl_Position  = gl_ModelViewProjectionMatrix * gl_Vertex;
>  \n"
> " v_texCoord   = gl_MultiTexCoord0.xy;
> \n"
> "}
> \n";
>
> static const char gFragmentShader1[] =
> "varying  mediump vec2 v_texCoord;
>   \n"
> "uniform sampler2D sam;
> \n"
> "void main() {
> \n"
> "gl_FragColor = texture2D(sam, v_texCoord);
> \n"
> "}
>
>
>
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Computing the bounding box of a node. Different approach.

2014-11-10 Thread Andrés Barrionuevo
Hi,

I've been playing around with the "Computing the world bounding box of
any node" example in the Cookbook, which uses a ShapeDrawable. I've read in the 
Doxygen docs that:


> 
> The implementation of ShapeDrawable is not geared to efficiency; it's better 
> to think of it as a convenience to render Shapes easily (perhaps for test or 
> debugging purposes) than as the right way to render basic shapes in some 
> efficiency-critical section of code.
> 


So, I thought I would try to create a custom box shape using a Geometry:

osgshapes.h

Code:

#ifndef OSGSHAPES_H
#define OSGSHAPES_H

#include "osg/PositionAttitudeTransform"

namespace osg {
class Geode;
}
  class Shape: public osg::PositionAttitudeTransform {
  public:
  Shape( const bool w = true );
  virtual bool create() = 0;

  int getScaleFactor() const
  {
  return scaleFactor;
  }
  void setScaleFactor( const int s );

  bool isWireframe() const
  {
  return wire;
  }
  void setWireframe( const bool w );
  protected:
  virtual ~Shape();
  private:
  bool wire;
  int scaleFactor;
  };

  class Box: public Shape {
  public:
  Box( const double l = 1. );
  bool create();

  double getLenght() const
  {
  return length;
  }
  void setLenght( const double l );
  protected:
  ~Box();
  private:
  double length;
  };

#endif




osgshapes.cpp

Code:

 namespace {
namespace BoxFactory {
void drawBox( osg::ref_ptr vert )
{
vert->push_back( osg::Vec3d( -1.0, -1.0, 1.0 ) );
vert->push_back( osg::Vec3d( 1.0, -1.0, 1.0 ) );
vert->push_back( osg::Vec3d( 1.0, 1.0, 1.0 ) );
vert->push_back( osg::Vec3d( -1.0, 1.0, 1.0 ) );

vert->push_back( osg::Vec3d( -1.0, -1.0, -1.0 ) );
vert->push_back( osg::Vec3d( 1.0, -1.0, -1.0 ) );
vert->push_back( osg::Vec3d( 1.0, 1.0, -1.0  ) );
vert->push_back( osg::Vec3d( -1.0, 1.0, -1.0 ) );
}

osg::ref_ptr getQuads()
{
osg::ref_ptr quads =
new osg::DrawElementsUInt( GL_QUADS )
;
// FRONT
quads->push_back( 0 );
quads->push_back( 1 );
quads->push_back( 2 );
quads->push_back( 3 );

// BOTTOM
quads->push_back( 0 );
quads->push_back( 1 );
quads->push_back( 5 );
quads->push_back( 4 );

// LEFT
quads->push_back( 0 );
quads->push_back( 4 );
quads->push_back( 7 );
quads->push_back( 3 );

// BACK
quads->push_back( 4 );
quads->push_back( 5 );
quads->push_back( 6 );
quads->push_back( 7 );

// TOP
quads->push_back( 3 );
quads->push_back( 2 );
quads->push_back( 6 );
quads->push_back( 7 );

// RIGHT
quads->push_back( 1 );
quads->push_back( 5 );
quads->push_back( 6 );
quads->push_back( 2 );

return quads;
}

osg::ref_ptr buildBox()
{
osg::ref_ptr geode = new osg::Geode;
osg::ref_ptr geom = new osg::Geometry;
geode->addDrawable( geom.get() );

osg::ref_ptr vertices = new osg::Vec3Array;
geom->setVertexArray( vertices );
//geom->setDataVariance( osg::Object::DYNAMIC );
//geom->setUseDisplayList( false );
//geom->setUseVertexBufferObjects( true );

drawBox( vertices );

osg::ref_ptr quads = getQuads();
geom->addPrimitiveSet( quads );
geom->getOrCreateStateSet()->setAttributeAndModes( new osg::Point( 
5.0f ) );
geom->addPrimitiveSet( new osg::DrawArrays(GL_POINTS, 0, 
vertices->size() ) );

return geode;
}
} // End BoxFactory
}
Shape::Shape( const bool w ) : osg::PositionAttitudeTransform(),
   scaleFactor( 1.0 )
{
setWireframe( w );
}
Shape::~Shape()
{
}

void Shape::setScaleFactor( const int s )
{
if( s == scaleFactor ) {
return;
}
scaleFactor = s;
const osg::Vec3d scale = getScale() * s;
setScale( scale );
}

void Shape::setWireframe( const bool w )
{
if( w == wire ) {
return;
}
wire = w;
osg::observer_ptr ss = getOrCreateStateSet();
ss->setMode( GL_LIGHTING, osg::StateAttribute::OFF );
osg::PolygonMode::Mode mode = ( w ) ? osg::PolygonMode::LINE
: osg::PolygonMode::FILL
;
osg::PolygonMode* pmode = new osg::PolygonMode(
osg::PolygonMode::FRONT_AND_BACK,
mode )
;
ss->setAttributeAndModes

[osg-users] UpdateCallback Behavior: Debug vs Rlease

2014-11-10 Thread Chris Hidden
Hey Everyone

A while ago I posted a topic on a low frame rate and seemed to have potentially 
solved it by running our application in release mode.  I am fairly new to 
graphics programming and didn't realize the difference was so great. 

I then had a son born and have been away for a while! :D.  Now I'm back to work 
and I've run into a new problem.

Two hand models are animated on the screen using data from our in house API 
which gets positional data from a LeapMotion. 

In release mode the model hands disappear on start up.  They seem to flash and 
then distort and then vanish in the blink of an eye.  If I debug to a log file 
looking at a bone on that hand it seems to be continuously 0.  However if I run 
it in debug mode the hand models work perfectly fine.  

We're a little stumped as to how this was happening and I thought I'd check and 
see if anyone has ever had similar problems and if it could be the way I'm 
handling things on the OSG side.  Its of course very possible its a bug on our 
end with our API software, but its always nice to check and see if anyone has 
any ideas or suggestions while we continue to delve.

I update the hand positioning using and UpdateCallback class that reads 
position data from a queue every frame and translates it into a matrix which is 
then used to position the hand model.  Also when the API notifies the hands as 
tracked the hand model is child to a Switch Node which I then hide or show 
using: 
 handsSw->setValue(0, true); 
&   handsSw->setValue(0, false);

handsSw which is a Switch has a child; handModel which is a PAT which in turn 
has the model-node as ITS child.  

Thank you!

Cheers,
Chris

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





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


Re: [osg-users] UpdateCallback Behavior: Debug vs Rlease

2014-11-10 Thread Robert Osfield
Hi Chris,

In theory there shouldn't be any difference in behaviour between release
and debug except for performance.  My best guess as for a cause of
differences would be an uninitialized variable somewhere in the scene graph
or application setup.  If you have a tool for analysing uninitialized
variables us this to see if this might be the cause and where the problem
is.

Robert.

On 10 November 2014 15:20, Chris Hidden  wrote:

> Hey Everyone
>
> A while ago I posted a topic on a low frame rate and seemed to have
> potentially solved it by running our application in release mode.  I am
> fairly new to graphics programming and didn't realize the difference was so
> great.
>
> I then had a son born and have been away for a while! :D.  Now I'm back to
> work and I've run into a new problem.
>
> Two hand models are animated on the screen using data from our in house
> API which gets positional data from a LeapMotion.
>
> In release mode the model hands disappear on start up.  They seem to flash
> and then distort and then vanish in the blink of an eye.  If I debug to a
> log file looking at a bone on that hand it seems to be continuously 0.
> However if I run it in debug mode the hand models work perfectly fine.
>
> We're a little stumped as to how this was happening and I thought I'd
> check and see if anyone has ever had similar problems and if it could be
> the way I'm handling things on the OSG side.  Its of course very possible
> its a bug on our end with our API software, but its always nice to check
> and see if anyone has any ideas or suggestions while we continue to delve.
>
> I update the hand positioning using and UpdateCallback class that reads
> position data from a queue every frame and translates it into a matrix
> which is then used to position the hand model.  Also when the API notifies
> the hands as tracked the hand model is child to a Switch Node which I then
> hide or show using:
>  handsSw->setValue(0, true);
> &   handsSw->setValue(0, false);
>
> handsSw which is a Switch has a child; handModel which is a PAT which in
> turn has the model-node as ITS child.
>
> Thank you!
>
> Cheers,
> Chris
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=61559#61559
>
>
>
>
>
> ___
> 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] [osgPlugins] Statically linked OpenSceneGraph trying to find dynamic plugins

2014-11-10 Thread Roberto Garrido
Hi,

I have successfully compiled static OSG 3.2.1 on my OSX 10.9 Machine. I did it 
by unchecking DYNAMIC_OPENSCENEGRAPH and DYNAMIC_OPENTHREADS options in CMake. 
That went fine.

I have now my own OSG app linking against static OSG, but I cannot load an OSG 
file. The file I want to load is cessna.osg from the sample dataset 3.0.0.

I have linked against osgPlugins-3.2.1/libosgdb_osg.a (release and debug), and 
also used the macro at the top of my main.cpp file:


Code:

#include 
USE_OSGPLUGIN(osg)




Also, although I'm not very sure about this one, I have defined as a 
preprocessor macro -DOSG_LIBRARY_STATIC.

When I run the app from command line having exported "OSG_NOTIFY_LEVEL=DEBUG", 
I get following:


Code:

MacBook-Pro-de-Roberto:Debug ro$ ./SimpleTest 
CullSettings::readEnvironmentalVariables()
DatabasePager::addDatabaseThread() HANDLE_NON_HTTP
DatabasePager::addDatabaseThread() HANDLE_ONLY_HTTP
Render::Render() 0x7fbfaac288c0
CullSettings::readEnvironmentalVariables()
CullSettings::readEnvironmentalVariables()
CullSettings::readEnvironmentalVariables()
CullSettings::readEnvironmentalVariables()
ShaderComposer::ShaderComposer() 0x7fbfaac29e10
CullSettings::readEnvironmentalVariables()
ShaderComposer::ShaderComposer() 0x7fbfaac2be10
_availableQueue.size()=2
itr='/Users/ro/Library/Application Support/OpenSceneGraph/PlugIns'
FindFileInPath() : trying /Users/ro/Library/Application 
Support/OpenSceneGraph/PlugIns/osgPlugins-3.2.1/osgdb_osg.so ...
itr='/Library/Application Support/OpenSceneGraph/PlugIns'
FindFileInPath() : trying /Library/Application 
Support/OpenSceneGraph/PlugIns/osgPlugins-3.2.1/osgdb_osg.so ...
itr='/Users/ro/Library/Application Support/OpenSceneGraph/PlugIns'
FindFileInPath() : trying /Users/ro/Library/Application 
Support/OpenSceneGraph/PlugIns/osgdb_osg.so ...
itr='/Library/Application Support/OpenSceneGraph/PlugIns'
FindFileInPath() : trying /Library/Application 
Support/OpenSceneGraph/PlugIns/osgdb_osg.so ...
Warning: dynamic library 'osgPlugins-3.2.1/osgdb_osg.so' does not exist (or 
isn't readable):
dlopen(osgPlugins-3.2.1/osgdb_osg.so, 9): image not found
DynamicLibrary::failed loading "osgPlugins-3.2.1/osgdb_osg.so"
itr='/Users/ro/Library/Application Support/OpenSceneGraph/PlugIns'
FindFileInPath() : trying /Users/ro/Library/Application 
Support/OpenSceneGraph/PlugIns/osgPlugins-3.2.1 ...
itr='/Library/Application Support/OpenSceneGraph/PlugIns'
FindFileInPath() : trying /Library/Application 
Support/OpenSceneGraph/PlugIns/osgPlugins-3.2.1 ...





It seems that OSG is trying to load dynamic ".so" plugins, but my OSG build is 
static!

Any ideas?
Thank you!

Cheers,
Roberto[/code]

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





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


Re: [osg-users] GeometryTechnique race condition crash

2014-11-10 Thread Robert Osfield
HI All,

On 7 November 2014 17:30, Robert Osfield  wrote:

> I have now written the basic code to move the management of the object
> cache to with the DatabasePager when the it's used in conjunction with
> object cache.  I haven't yet tested it but have run out of week so will
> need to return to testing next week.  If all goes well I'll check these
> changes in and look for wider testing.
>

I have now done some testing on the new object cache handling in the
DatabasePager and this has gone fine, but my tests only touched part of the
possible range of usage models with using the database pager and the object
cache so would appreciate testing out on the community.  I have just
checked my changes in.

Could you check out svn/trunk and let me know how you get on.

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


Re: [osg-users] GeometryTechnique race condition crash

2014-11-10 Thread Trajce Nikolov NICK
Hi Robert,

I ve been following this thread from the beginning since I had issues with
the database pager so I thought it might be related. I have different big
datasets so I am going to give it a shot tomorrow and ping you with the
findings

Nick

On Mon, Nov 10, 2014 at 5:12 PM, Robert Osfield 
wrote:

> HI All,
>
> On 7 November 2014 17:30, Robert Osfield  wrote:
>
>> I have now written the basic code to move the management of the object
>> cache to with the DatabasePager when the it's used in conjunction with
>> object cache.  I haven't yet tested it but have run out of week so will
>> need to return to testing next week.  If all goes well I'll check these
>> changes in and look for wider testing.
>>
>
> I have now done some testing on the new object cache handling in the
> DatabasePager and this has gone fine, but my tests only touched part of the
> possible range of usage models with using the database pager and the object
> cache so would appreciate testing out on the community.  I have just
> checked my changes in.
>
> Could you check out svn/trunk and let me know how you get on.
>
> Cheers,
> Robert.
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>


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


Re: [osg-users] problem with Nvidia card

2014-11-10 Thread Steve Jones

gambr wrote:
> Hi Markus,
> unfortunately this is not the case: there is just one graphic card.
> And the laptop is not connected to an external monitor (with other laptops 
> OSG does not work fine indeed in an external monitor).
> 
> Any other idea?
> 
> Regards
> Gianni

I have a laptop with one "card" but two adapters.  It has an integrated Intel 
graphics adapter and a separate discrete NVidia graphics adapter (video card) 
that is installed to an internal slot in the laptop.  Two adapters.  At times I 
switch to the integrated adapter for power savings when running on battery 
forgetting it doesn't work well with highly graphics intensives apps (eg. 
games).  Once I switch back to the NVidia adapter the apps run fine.  

I say this to make sure your laptop isn't inadvertently set to use the 
integrated graphics adapter.

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





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


[osg-users] iOS : How to set a transparent background?

2014-11-10 Thread Liu Xiao
Hi,

I am now working on a project of augmented reality. To make it work, I have to 
make osg drawing on a transparent background . (The view below osg is camera 
capture.) 

I use setClearColor as follows, this code really works on the older version of 
osg 3.1.4 with opengles 1.1. But when I change to osg 3.2.1 with opengles 2.0, 
it does not make a transparent background but a black one.


Code:
- (void)setupCamera
{
//set the clear color of the camera to be semitransparent
_viewer->getCamera()->setClearColor(osg::Vec4(0.0f, 0.0f, 0.0f, 0.0f));
//set the clear mask for the camera
_viewer->getCamera()->setClearMask(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);

_viewer->getCamera()->setRenderOrder(osg::Camera::POST_RENDER);

_viewer->getCamera()->setComputeNearFarMode(osgUtil::CullVisitor::DO_NOT_COMPUTE_NEAR_FAR);

}



Also my shaders is as follows :
[code]static const char gVertexShader1[] =
"varying vec2 v_texCoord; \n"
"void main() {  \n"
"gl_Position  = gl_ModelViewProjectionMatrix * gl_Vertex;   \n"
" v_texCoord   = gl_MultiTexCoord0.xy;  
  \n"
"}  \n";

static const char gFragmentShader1[] =
"varying  mediump vec2 v_texCoord;  
\n"
"uniform sampler2D sam; 
   \n"
"void main() {  
  \n"
"gl_FragColor = texture2D(sam, v_texCoord); 
   \n"
"}  \n";
osg::Shader* vShader = new osg::Shader( osg::Shader::VERTEX, gVertexShader1 
);
osg::Shader* fShader = new osg::Shader( osg::Shader::FRAGMENT, 
gFragmentShader1 );

osg::Program* program = new osg::Program;
program->addShader( vShader );
program->addShader( fShader );
stateSet->setAttribute( program );[/color]

And the other code of drawing osg file:
[code]// Init the Windata Variable that holds the handle for the Window to 
display OSG in.
osg::ref_ptr windowData = new 
osgViewer::GraphicsWindowIOS::WindowData(self->osgView, 
osgViewer::GraphicsWindowIOS::WindowData::IGNORE_ORIENTATION, windowFactor);

// Init the Windata Variable that holds the handle for the Window to 
display OSG in.
osg::ref_ptr windata = windowData;

// Setup the traits parameters
traits->x = 0;
traits->y = 0;
traits->width = m_glview.frame.size.width*windowFactor;
traits->height = m_glview.frame.size.height*windowFactor;
traits->depth = 16; //keep memory down, default is currently 24
traits->alpha = 1;
//traits->stencil = 8;
traits->windowDecoration = false;
traits->doubleBuffer = true;
traits->sharedContext = 0;
traits->setInheritedWindowPixelFormat = true;
//traits->windowName = "osgViewer";

traits->inheritedWindowData = windata;

// Create the Graphics Context
osg::ref_ptr graphicsContext = 
osg::GraphicsContext::createGraphicsContext(traits.get());

//create the viewer
_viewer = new osgViewer::Viewer();
//if the context was created then attach to our viewer

if(graphicsContext)
{
_viewer->getCamera()->setGraphicsContext(graphicsContext);
_viewer->getCamera()->setViewport(new osg::Viewport(0, 0, 
traits->width, traits->height));
}
[/code]

Does anybody know how to solve this problem ? 

Thank you!

Cheers,
Liu

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





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