Re: [osg-users] Visual Studio 2010 3rd Party

2010-07-20 Thread Benoît Bayol
Hi,

I've got the same problem.
Did you finally find a solution to this ?

Thank you!

Cheers,
Benoît


-- 
Benoît Bayol
benoit.ba...@gmail.com

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





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


Re: [osg-users] Point in Polygon problem

2010-07-19 Thread Benoît Bayol
Hi,

Reply to myself : Using osgUtil::DelaunayConstraint and after using the 
contains() method.

Thank you!

Cheers,
Benoît


-- 
Benoît Bayol
benoit.ba...@gmail.com

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





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


[osg-users] Point in Polygon problem

2010-07-16 Thread Benoît Bayol
Hi,

I want to know if there is a standard algorithm included in osg for the point 
in polygon problem ? (ie finding if M belongs to P).

Thank you!

Cheers,
Benoît


-- 
Benoît Bayol
benoit.ba...@gmail.com

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





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


[osg-users] ShadowedScene, Camera and Callback

2009-11-19 Thread Benoît Bayol
Hi,

I want to make a screenshot of a osgShadow::ShadowScene.
I have created an osg::Camera this way :

Code:

  camera-setClearColor(osg::Vec4(0.8f,0.8f,0.8f,1.0f));
  camera-setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  camera-setReferenceFrame(osg::Transform::ABSOLUTE_RF);
  camera-setProjectionMatrixAsPerspective(90,1.0,x,2*x);
  camera-setViewMatrixAsLookAt(_position,
_lookAt,
osg::Vec3f(0.0f,0.0f,1.0f)
);
  camera-setViewport(0,0, xres, yres);
  camera-setRenderOrder(osg::Camera::POST_RENDER);
  camera-setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);

  camera-attach(osg::Camera::COLOR_BUFFER, myImage);
  camera-setFinalDrawCallback(new WriteCallback(filename, camera, myImage));

  camera-addChild(_originalModel);
[\code]

If I make 
viewer.realize();
viewer.frame();

I will not see my 3D model.
If I do viewer.frame() once more I will see my 3D model but no shadow on it.

I know the problem is coming from the camera because if i create a viewer and 
run it with the same _originalModel before entering my screenshot procedure 
there is no problem.

Someone could explain me the logic behind it ? I mean do I have to make a trick 
for having shadow on my screenshot. I have read about 2 cameras on another 
topic but not sure about.

Thank you all :)

Cheers,
Benoît




-- 
Benoît Bayol
benoit.ba...@gmail.com

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





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


[osg-users] Outputing a movie

2009-11-12 Thread Benoît Bayol
Hey all,

I have to create a software for video animation. We wants to see the growthing 
of landscapes.

For the moment I output a .jpg of my scene for first frame and I redo it for x 
frames then I convert all my jpgs to .gif/.mpg thanks to ImageMagick.

I want to know if there is a plugin capable of retaining osg::Images and write 
them to a video format ? Or anyone knows a good/easy c++ library for that ?

Thanks all :)

Benoît


-- 
Benoît Bayol
benoit.ba...@gmail.com

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





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


Re: [osg-users] Macintosh: best build practices

2009-07-01 Thread Benoît Bayol
Hi,

If you plan to install OSG as a system library with XCode don't forget to do :


Code:
sudo xcodebuild -target install -configuration Release



XCode cannot proceed to install directly.

Thank you!

Cheers,
Benoît


-- 
Benoît Bayol
benoit.ba...@gmail.com

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





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


[osg-users] Impostor, Billboard Cloud, saving Texture to File

2009-06-19 Thread Benoît Bayol
Hey OSG Community :)

I am coding an algorithm based on billboard clouds described in this article 
http://www.cs.auckland.ac.nz/~novins/Publications/Huang04.pdf but I have some 
problems for managing the creation of texture files.

I have read to osghud, osgprerender and osgsim::impostor code. I am able to 
create my own impostor thanks to a camera in Ortho2D mode and FBO to a texture 
2D renderered on a quad.


Code:

  //Initialisation of camera with alpha
  osg::Camera* camera = new osg::Camera;
  camera-setClearColor(osg::Vec4(1.0f,0.0f,0.0f,0.0f));
  camera-setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

  const osg::BoundingSphere bs = myModel-getBound();

  //Creating texture
  osg::Texture2D * texture = new osg::Texture2D;
  float textureWidth = 1024;
  float textureHeight = 1024;
  texture-setTextureSize(textureWidth, textureHeight);
  texture-setInternalFormat(GL_RGBA);
  texture-setFilter(osg::Texture2D::MIN_FILTER,osg::Texture2D::LINEAR);
  texture-setFilter(osg::Texture2D::MAG_FILTER,osg::Texture2D::LINEAR);
  
  //Creating quad geometry
  osg::Geometry * polyGeom = CreateQuadGeometry(myModel);
  
  //Linking texture with geometry
  osg::StateSet* stateset = polyGeom-getOrCreateStateSet();
  stateset-setTextureAttributeAndModes(0, texture ,osg::StateAttribute::ON);
  
  //Creating the geode and adding my quad
  osg::Geode* geode = new osg::Geode();
  geode-addDrawable(polyGeom);
  
  //Adding group with my geode and camera
  osg::Group * parent = new osg::Group;
  parent-addChild(geode);
  parent-addChild(camera);
 
  //Configuring Ortho projection and FBO for camera
  
camera-setProjectionMatrixAsOrtho2D(-bs.radius(),bs.radius(),-bs.radius(),bs.radius());
  camera-setReferenceFrame(osg::Transform::ABSOLUTE_RF);
  
camera-setViewMatrixAsLookAt(bs.center()-osg::Vec3(0.0f,1.0f,0.0f)*bs.radius(),bs.center(),osg::Vec3(0.0f,0.0f,1.0f));
  camera-setViewport(0,0,textureWidth,textureHeight);
  camera-setRenderOrder(osg::Camera::PRE_RENDER);
  camera-setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
  
  //Adding the model to RTT
  camera-addChild(myModel);
  camera-attach(osg::Camera::COLOR_BUFFER, texture);
  
  //Adding a callback for export
  TextureSavingCallback * myTSC = new TextureSavingCallback(myfile.png, 
camera);
  camera-setFinalDrawCallback(myTSC);




Now I want to save my model (quad+texture) into an obj file.

So basically I said to myself :
- Create an Image during a Callback
- Allocate it with Image::allocateImage
- Save the texture into with Image::readImageFromCurrentTexture
- Save Image thanks to osgDB


Code:

if (viewport  _image.valid())
  {
_image-allocateImage(int(viewport-width()), 
int(viewport-height()), 1, GL_RGBA, GL_FLOAT);
//Here image-readPixels works fine since I have something in my image 
after
_image-readImageFromCurrentTexture(0,false,GL_FLOAT);
osgDB::writeImageFile(*_image, _filename);




And after reload the texture and apply it to the quad for saving into OBJ with 
OSGDB.
As you will guess it doesn't work and I only have the allocating output into my 
image.

Do you have any idea of how I can handle this ?

Thank you!

Cheers,
Benoît


-- 
Benoît Bayol
benoit.ba...@gmail.com

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





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


Re: [osg-users] Writing to an image file

2009-06-15 Thread Benoît Bayol
Hi,

I have the same problem than Amanda.
I am creating a class SimpleBillboard which load a Model, create an ortho 
projection of it and a Quad and try to put the texture projeted onto that quad.

I think that Amanda try to output the texture loaded into an image file.
The problem is that after the allocation of the image, we write our image but 
there is no information in the buffer at this point. Because the loop has not 
started may be.

So the question should be :
How I can force OSG to render the texture into the buffer and then put it into 
the image. And not waiting for the loop. Is callback could be usefull here ?

Thank you!

Cheers,
Benoît


-- 
Benoît Bayol
benoit.ba...@gmail.com

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





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


[osg-users] Creating a Tree with recursive algo + osg:Geometry

2008-12-15 Thread Benoît Bayol

Hi all :)

I am actually building an application which builds tree or any kind of  
plants.


So for a tree we have the trunk and branches which are composed by  
little elements that we called metamers. Each metamers are linked with  
others.


My first shot with OSG was to create a recursive algorithm that  
created a geode with a geometry at each metamers with the good  
osg::MatrixTransform for calculating position. But it was too slow at  
rendering because of culling, indeed I had about 3000 geodes with a  
geometry into each of them.


So I have decided to build the whole plant as a geometry and add it to  
a simple geode. So now only one geode and one geometry.


My question is how I can sum the geometry easily ?

osg::ref_ptrosg::Geometry Metamer::Build(Base  myBase)
{
osg::ref_ptrosg::Geometry myInternode = this-in.Build(myBase);
this-geometry-setVertexArray(myInternode-getVertexArray());
this-geometry-addPrimitiveSet(myInternode-getPrimitiveSet(0));

myBase.applyDeviationAngle(60);

if (this-GetLateralMetamer(0) != NULL)
{
osg::ref_ptrosg::Geometry lateralMetamer = this- 
GetLateralMetamer(0)-Build(myBase);

//HERE IS THERE ANYWAY TO ADD OSG::GEOMETRY TOGETHER ?
this-geometry-setVertexArray(lateralMetamer-getVertexArray());
this-geometry-addPrimitiveSet(lateralMetamer- 
getPrimitiveSet(0));

}


return this-geometry;
}

Thank you for helping :)___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org