Re: [osg-users] How to make OSG support very large Pixels images(For Map Texture)?

2011-08-29 Thread Jan Ciger
2011/8/29 xyc508 

>  Hi,osger all,
>
> Who can tell how much Pixel most for .jpg can OSG support?
> I have a 5405X5634 Pixel .JPG File,but OSG can't read it(For Map Texture),
> How to make OSG support very large Pixels images?
> Thanks ahead.
>
>

Hello,

I am quite sure that you wouldn't be able to use such large texture anyway -
most hardware allows textures 4096x4096 maximum. You have to split it up and
use some paging approach, loading only tiles as they are needed.

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


[osg-users] Who can tell how much Pixel most for .jpg can OSG support?

2011-08-29 Thread Sergey Kurdakov
Hi Donlin,

> Who can tell how much Pixel most for .jpg can OSG support?

it depends on your graphics card
see http://vterrain.org/LargeTextures/ ( btw vterrain uses OSG )

note - while OSG can resize large textures - textures ( not texture
rectangles ) are of power of 2, so be sureto resize it before hand

Regards
Sergey


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


Re: [osg-users] Uniform array naming problem

2011-08-29 Thread Philippe Massicotte
Hi,

Instead of trimming [0] from the name, as previously suggested, we should 
detect if a uniform name has it, but add BOTH 'name[0]' and 'name' into 
Program::_uniformInfoMap, so that when the osg::Uniform are applied, there will 
be a name match for whatever the driver returns... Both are actually valid.

The fix I have applied in my osg version, in 
void Program::PerContextProgram::linkProgram(osg::State& state)


// For some drivers, active uniform array names are returned as 'name', and for 
others, 'name[0]'
// The way OSG works is to lookup into the program's active uniforms to see if 
a uniform set in a StateSet 
//   is present, and apply it only in that case. But that mechanic fails if the 
active uniform name
//   includes the backets, but not the other, and vice-versa.  So add both into 
the _uniformInfoMap
//   to fix this, as both names are valid and allowed by OpenGL specifications
std::string strName(name);
if(strName.length() > 3 && strName.substr(strName.length()-3, 3) == 
std::string("[0]"))
  _uniformInfoMap[strName.substr(0, strName.length()-3)] = 
ActiveVarInfo(loc,type,size);


Thank you!

Cheers,
Philippe

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





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


Re: [osg-users] Who can tell how much Pixel most for .jpg can OSG support?

2011-08-29 Thread Robert Osfield
On Mon, Aug 29, 2011 at 3:14 PM, Sergey Kurdakov  wrote:
> note - while OSG can resize large textures - textures ( not texture
> rectangles ) are of power of 2, so be sureto resize it before hand

Small note, the osg::Texture2D will resize non power of two textures
by default, but you can disable this where your hardware + drivers
support non power of two textures.  Just set do:

  texture->setResizeNonPowerOfTwoHint(false);

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


Re: [osg-users] Drawing a simple sphere...

2011-08-29 Thread Tony Horrobin
Hi Yann,

I have tried your code with osg trunk under Windows 7 32bit and can report that 
it does not crash.

All I can suggest is to replace use of native pointers with osg::ref_ptr.

So for example:

Code:
osg::Geode * geode = new osg::Geode();


becomes


Code:
osg::ref_ptr< Geode > geode = new osg::Geode();



Cheers,

-Tony

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





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


[osg-users] How to force reloading the texture in the shader

2011-08-29 Thread Fred Maulir
Hello to All,

I'm having a very specific issue using OpenSceneGraph. While using a texture 
shader I developped, I need to attach a texture to my object. But my texture 
need to be changed at each frame. However, I noticed that my texture is not 
updated in the next viewer.update() if my computer is very fast. If I slow down 
my computer it is correctly synchronized.

In other word, I'm looking for a way to way for a texture object to be 
propagated in the gpu buffer before rendering the frame.

As I'm using OpenSceneGraph for simulation purpose even 1 frame offset is not 
acceptable for me.


Basically the code can be summed up this way:

Code:

osg::Image IMAGE;
IMAGE->setImage(..., imageData, osg::Image::AllocationMode::NO_DELETE);

osg::StateSet *mystate = new osg::StateSet();
osg::Texture2D *texture = new osg::Texture2D();
texture->setImage(IMAGE);

(...)

for(int i=0;idone();++i)
{
IMAGE->setImage(..., ImageData[i], osg::Image::AllocationMode::NO_DELETE);


viewer->frame(ctime);
}



In this example when rendering the scene OSG sometimes uses the ImageData of 
index i-1 instead of index i


If anyone can help me I would be very happy.
Regards.

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





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


Re: [osg-users] Autoshadow aliasing in shadow maps

2011-08-29 Thread Sergey Polischuk
Hi, Justo

All shadowmapping techniques have problems with such aliasing problems. You can 
try use shadow volumes technique as it dont suffer from this problem and 
generates correct shadows in any case, but it have other drawbacks. IIRC this 
algo also implemented in osgShadows.

Cheers,
Sergey.

25.08.2011, 22:12, "Justo Ureña" :
> Hi,
>
> I´m testing diferent shadows techniques for my scene, and after some adjusts, 
> I got them working fine... Except for very big aliasing that appears in some 
> surfaces that are parallel to the light direction. It happens in all the 
> shadow maps techniques (ShadowMap, StandardShadowMap, LISPSM)... and I´ve 
> tried all the things that I could imagine to get rid of them without 
> success... Please, anyone can help me with that?
>
> From my investigation I got that the problem is that the depth map calculated 
> by the shadow camera does not fit exactly with the curved shape in the scene. 
> In the attachment you can see a render of the scene (that only includes the 
> cessna and a vertical directional light that produces the shadow) coloured 
> with the depth map. As you can see, in the laterals of the cessna appear 
> these withe stiches that means that the depth calculated in these texels of 
> the map is infinite, what is obviously wrong. There is any way to avoid this 
> annoying effect?
>
> Thank you very much!
>
> Cheers,
> Justo
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=42241#42241
>
> ___
> 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 force reloading the texture in the shader

2011-08-29 Thread Sergey Polischuk
Hi, Fred

Try setting singlethreaded threading model to viewer 
(viewer->setThreadingModel(osgViewer::ViewerBase::SingleThreaded)) or setting 
texture data variance to dynamic 
(texture->setDataVariance(osg::Object::DYNAMIC))

Cheers,
Sergey.

30.08.2011, 01:32, "Fred Maulir" :
> Hello to All,
>
> I'm having a very specific issue using OpenSceneGraph. While using a texture 
> shader I developped, I need to attach a texture to my object. But my texture 
> need to be changed at each frame. However, I noticed that my texture is not 
> updated in the next viewer.update() if my computer is very fast. If I slow 
> down my computer it is correctly synchronized.
>
> In other word, I'm looking for a way to way for a texture object to be 
> propagated in the gpu buffer before rendering the frame.
>
> As I'm using OpenSceneGraph for simulation purpose even 1 frame offset is not 
> acceptable for me.
>
> Basically the code can be summed up this way:
>
> Code:
>
> osg::Image IMAGE;
> IMAGE->setImage(..., imageData, osg::Image::AllocationMode::NO_DELETE);
>
> osg::StateSet *mystate = new osg::StateSet();
> osg::Texture2D *texture = new osg::Texture2D();
> texture->setImage(IMAGE);
>
> (...)
>
> for(int i=0;idone();++i)
> {
> IMAGE->setImage(..., ImageData[i], osg::Image::AllocationMode::NO_DELETE);
>
> viewer->frame(ctime);
> }
>
> In this example when rendering the scene OSG sometimes uses the ImageData of 
> index i-1 instead of index i
>
> If anyone can help me I would be very happy.
> Regards.
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=42294#42294
>
> ___
> 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] How can I get the vertices of an .obj or how can I draw a geometry in OSG with a vertices array?

2011-08-29 Thread Jose Navarro
Hi,

I am new on all this stuff. So, I apologize if my questions are so simple.

I am working in visual studio 2008 and OSG. In my scene, I load some .obj files 
and I want to detect collision between them. I want to retrieve the vertices of 
my .obj geometry to star working with them. does anybody know how can I do 
this? or have an advice?


Thank you!

Cheers,
Jose

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





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


[osg-users] When ref_ptrs get deleted

2011-08-29 Thread David Benoit
Hi,

I was having memory issues with my OSG scene.  I was calling removeChild() but 
didn't appear to be getting my memory back.  In my application, I frequently 
add and remove large texture mapped geometries.  In particular, after one 
operation I might remove about 125 geometries with 3 vertices and a similar 
number of TRIANGLES, and replace them with new ones.  I was running out of 
memory when doing this, even though I can easily add more than 300 such objects 
from scratch.

My solution was 


Code:
_gw = new osgViewer::GraphicsWindowEmbedded(...);
osg::DeleteHandler* dh = new osg::DeleteHandler;
_gw->setDeleteHandler(dh);

// ... later after adding and removing objects...
dh->flush()




First, is this a standard way to force objects to be deleted?  Second, is there 
a better way?  Third, hopefully this will be useful to someone in the future 
faced with the same issue.

Cheers,
Doug

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





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


Re: [osg-users] How can I get the vertices of an .obj or how can I draw a geometry in OSG with a vertices array?

2011-08-29 Thread Wang Rui
Hi Jose,

Use node visitor to find all child geodes of the newly loaded node.
And they convert the drawables of each geode to osg::Geometry object
with a dynamic_cast<>. If the conversion successes, you may obtain the
vertices and primitive sets simply from Geometry's APIs.

Cheers,

Wang Rui


2011/8/30 Jose Navarro :
> Hi,
>
> I am new on all this stuff. So, I apologize if my questions are so simple.
>
> I am working in visual studio 2008 and OSG. In my scene, I load some .obj 
> files and I want to detect collision between them. I want to retrieve the 
> vertices of my .obj geometry to star working with them. does anybody know how 
> can I do this? or have an advice?
>
>
> Thank you!
>
> Cheers,
> Jose
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=42297#42297
>
>
>
>
>
> ___
> 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] When ref_ptrs get deleted

2011-08-29 Thread Paul Martz

On 8/26/2011 11:18 AM, David Benoit wrote:

Hi,

I was having memory issues with my OSG scene.  I was calling removeChild() but 
didn't appear to be getting my memory back.


When you call removeChild(), Referenced::unref() should get called. You should 
be able to set a breakpoint there to see whether the reference count dropped to 
zero (I suspect it didn't, indicating the memory was either referenced by 
another ref_ptr somewhere, or you had explicitly called ref() ).


Also note that some memory management systems don't free memory back to the 
system, they free it back to the process. If memory is being freed to the 
process, process size doesn't shrink when memory is deallocated. This is not an 
OSG issue, but I mention it here because your post doesn't say how you reached 
the conclusion that your app was leaking memory.


There have been countless threads discussing OSG memory usage in this mailing 
list over the years. I imagine a good search of the archives might shed some 
light on the issue you encountered.

   -Paul

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


Re: [osg-users] How can I get the vertices of an .obj or how can I draw a geometry in OSG with a vertices array?

2011-08-29 Thread Paul Martz

On 8/29/2011 4:28 PM, Jose Navarro wrote:

Hi,

I am new on all this stuff. So, I apologize if my questions are so simple.

I am working in visual studio 2008 and OSG. In my scene, I load some .obj files 
and I want to detect collision between them. I want to retrieve the vertices of 
my .obj geometry to star working with them. does anybody know how can I do 
this? or have an advice?


If you use osgBullet.googlecode.com, you can convert your scene graph directly 
to a Bullet collision shape and use Bullet to perform collision detection. In 
this case, you wouldn't need to access the vertices directly.


Even if you don't want to use Bullet for collision detection, the osgBullet 
project contains the CollectVerticesVisitor, which collects a set of transformed 
vertices from a scene graph. You might find this code useful.

   -Paul

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


Re: [osg-users] How to force reloading the texture in the shader

2011-08-29 Thread Fred Maulir
Sergey.

Thanks really A LOT for your fast and VERY EFFICIENT help. This problem drove 
me crazy for a while.

The setting texture->setDataVariance(osg::Object::DYNAMIC) did not help but the 
viewer->setThreadingModel(osgViewer::ViewerBase::SingleThreaded) worked very 
well.

Thanks again for your help.
Regards.

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





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