Re: [osg-users] OSG 3.0.1 crash in glDrawElements() under Windows Remote Desktop

2012-05-31 Thread Sergey Polischuk
iirc osg can statically link with opengl lib, so you can make 2 binaries: one with mesa statically linked in, and other using whatever opengl32.dll system have. Cheers. 31.05.2012, 23:04, "Simon Hammett" :On 31 May 2012 17:17, Andrew Cunningham  wrote:When running a Windows OSG 3.0.1 application under Windows Remote Desktop the OpenGL driver defaults to the (ancient) software MS OpenGL GDI renderer v1.1.  Unfortunately, I need to make the basics of our app work under RDC.  I am finding that glDrawElements ( called from void DrawElementsUInt::draw) crashes every time inside the MS OpenGL driver when given a geometry with say, 3000 elements. With smaller numbers of elements there are no problems.  This is code that works perfectly when running under accelerated drivers such as nVidia/ATI etc. I experimented with breaking up the drawing of elements into blocks of size GL_MAX_ELEMENTS_INDICES_WIN with no luck. It seems that repeated calls to glDrawElements in a loop even with a small number of elements cause the same issue.  This is almost certainly a bug in the driver, but I am wondering if anyone has a workaround that can be done at the OSG level.  ThanksYou can use mesa instead when running under RDC.  http://www.mesa3d.org, works well and even supports shaders.  If you can create an install specifically for RDC users then you can just put the mesa version of opengl32.dll in with your app and you are done. If you need to dynamically chose between mesa/hardware renderer, you'll need to do some monkeying about though,either loading osg/opengl via LoadLibrary or you'll have to create a little launcher program to modify the current PATH so the mesa dlls are/are not found as appropriate.  BTW, don't try and delay load opengl32. I tried that when I wanted to dynamically chose the open gl version and it causes odd problems. -- http://www.ssTk.co.uk___osg-users mailing listosg-users@lists.openscenegraph.orghttp://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] Enabling notifications from within program?

2012-05-31 Thread Sergey Polischuk
Hi

You can set your own notify handler like this to check if you ever get messages 
from osg:

class NH : public osg::NotifyHandler
{
public:
NH()
: m_out("osg_log.txt")
{
}
~NH()
{
m_out.close();
}
void notify (osg::NotifySeverity severity, const char *message)
{
m_out << message;
}
private:
std::ofstream m_out;
};

osg::setNotifyHandler(new NH);

Cheers,
Sergey.

31.05.2012, 22:25, "Preet" :
> Hi Robert,
>
> That's what I'm currently doing (ie using stack traces to try and
> figure stuff out), but I was wondering why osg doesn't give me *any*
> output at all. For instance, I'm apparently able to do a bunch of
> stuff: Load an *.osg model, setup an animation path, create nodes,
> etc, pretty much all of the scene setup goes fine up until I try to
> create the viewer. Doesn't doing any of those things before the viewer
> provide output when I've set the notify level to debug? I made sure I
> compiled with OSG_DISABLE_NOTIFY (or whatever the exact wording for
> that flag was) to allow notifications.
>
> On Thu, May 31, 2012 at 4:57 AM, Robert Osfield
>  wrote:
>
>>  Hi Preet,
>>
>>  The osg::notify system isn't related to handling of std exceptions
>>  except where some specific code might catch an exception and report
>>  the output to osg::notify.  This means that upping the notify level
>>  won't effect how exceptions are handled.
>>
>>  The best thing to do is run a debugger and the look at the stack trace
>>  where the application crashes.
>>
>>  Robert.
>>
>>  On 31 May 2012 07:57, Preet  wrote:
>>>  Hiya,
>>>
>>>  I'm trying to debug a std::bad_alloc() exception from osg that doesn't
>>>  product any other output. I can't set environment variables, so I
>>>  tried:
>>>  osg::setNotifyLevel(osg::DEBUG_INFO);
>>>
>>>  This still doesn't give me any output. The system I'm on dumps stdout
>>>  and stderr to a log file in a specific directory and since Notify.cpp
>>>  dumps to both of those it seems like I should be seeing something, but
>>>  I'm not. However, I do get statements like "std::cout << "Hello" <<
>>>  std::endl" outputted as expected when used in my application (just not
>>>  from osg). Am I missing something obvious?
>>>
>>>  Preet
>>>  ___
>>>  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
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Enabling notifications from within program?

2012-05-31 Thread Ulrich Hertlein
Hi Preet,

On 1/06/12 4:25 , Preet wrote:
> That's what I'm currently doing (ie using stack traces to try and
> figure stuff out), but I was wondering why osg doesn't give me *any*
> output at all. For instance, I'm apparently able to do a bunch of
> stuff: Load an *.osg model, setup an animation path, create nodes,
> etc, pretty much all of the scene setup goes fine up until I try to
> create the viewer. Doesn't doing any of those things before the viewer
> provide output when I've set the notify level to debug? I made sure I
> compiled with OSG_DISABLE_NOTIFY (or whatever the exact wording for
> that flag was) to allow notifications.

Loading a file will certainly produce output with the proper OSG_LOG_LEVEL.
I'm wondering if whatever subsystem is redirecting output to a log file in your
application is maybe run after OSG sets up its logging and so they're going to 
different
file descriptors?

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


Re: [osg-users] Clipping lights in a scene

2012-05-31 Thread Ron Mayer

robertosfield wrote:
> Hi Ron, 
> OpenGL fixed function pipeline doesn't support using clip planes and lighting 
> in the way you want. This means you will need use either multiples or 
> projective texturing to achieve the result you want. 
> Robert On May 30, 2012 4:29 PM, "Ron Mayer" < ()> wrote:
> >  Hi,
> > 
> > I would like to have a colored light applied to my scene, restricted by 
> > some clipping planes.
> > For example, I would like to shed a green light on anything that is only to 
> > the right of the half plane x = 5, to the left of the half plane x = -5, 
> > above the half-plane y = 10, and under the half plane y = -10.
> > 
> > I saw there is a class osg::ClipNode related to LightSource but I am not 
> > sure how to use it. I also tried looking at the osg examples, and searched 
> > the forums but did not find anything.
> > 
> > Thank you!
> > Ron
> > 
> > --
> > Read this topic online here:
> > http://forum.openscenegraph.org/viewtopic.php?p=47945#47945 
> > (http://forum.openscenegraph.org/viewtopic.php?p=47945#47945)
> > 
> > 
> 
> 
> 
> 
> ___
> osg-users mailing list
>  ()
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org 
> (http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org)
> 


I tried implementing the texture projection today but had some difficulties 
getting it to work.
In our setup we already have one image projection setup for displaying video at 
(let's say) the z=0 plane at location (0, 0).
For this we have a scene looking like this:

[Image: http://img135.imageshack.us/img135/8341/scenej.jpg ] 
(http://imageshack.us/photo/my-images/135/scenej.jpg/)


It works nicely.
Now, I would like to define a prism around x, y = (0, 0) (on the z=0 plane) 
such that anything outside of that prism will be projected onto with a green 
color. For example, if I have a cube that is half inside and half outside the 
prism, the outside part will have the projection.

Here is what I tried:
I created an additional texture (in geode on the right side of the diagram)  
setting alpha = 0, so it will be transparent, then I called setBorderColor with 
green, and gave it a small alpha to make it transparent. I was hoping this 
would make the inside of the prism transparent and outsde green.
I then went and added a new transform and texgen under the root. I set the 
texgen to have the planes be at where I want the walls of the prism to be (I am 
using ortho projection here).

The result:
The entire world is projected with green ...

I am not sure if I should continue with this direction. One thing I thought of 
doing is creating 4 textures and having 4 texgens for each texture and 
projecting on the 4 regions around the "sterile square" I have. Top view of my 
world (looking from above the z=0 plane):

[Image: http://img198.imageshack.us/img198/3776/regionsa.jpg ] 
(http://imageshack.us/photo/my-images/198/regionsa.jpg/)


S - the sterile region (which already has texture projection at its center for 
video)
R1, R2, R3, R3 - regions where any object inside it gets projected with a red 
color, each region will have its own texture projection 

Thanks again
Ronny



 --
Post generated by Mail2Forum[/quote]

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





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


Re: [osg-users] OSG 3.0.1 crash in glDrawElements() under Windows Remote Desktop

2012-05-31 Thread Andrew Cunningham
Ok, thanks for that idea. I will definitely look into using Mesa.

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





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


[osg-users] osgDB::readImageFile don't work correctly

2012-05-31 Thread Christian Rumpf
Hi,

I wanted to experiment a little bit with osg::Image, but when I used 
osgDB::readImageFile("..."); in my beginner's guide to read a png, I got the 
following message:


> Warning: Could not find plugin to read objects from file "clockface.jpg".


I installed osg-library according to osg guide with cmake for VS 2010. Does 
somebody know what the issue could be?

lg Christian

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





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


Re: [osg-users] OSG 3.0.1 crash in glDrawElements() under Windows Remote Desktop

2012-05-31 Thread Simon Hammett
On 31 May 2012 17:17, Andrew Cunningham  wrote:

> When running a Windows OSG 3.0.1 application under Windows Remote Desktop
> the OpenGL driver defaults to the (ancient) software MS OpenGL GDI renderer
> v1.1.  Unfortunately, I need to make the basics of our app work under RDC.
>
> I am finding that glDrawElements ( called from void
> DrawElementsUInt::draw) crashes every time inside the MS OpenGL driver when
> given a geometry with say, 3000 elements. With smaller numbers of elements
> there are no problems.
>
> This is code that works perfectly when running under accelerated drivers
> such as nVidia/ATI etc. I experimented with breaking up the drawing of
> elements into blocks of size GL_MAX_ELEMENTS_INDICES_WIN with no luck. It
> seems that repeated calls to glDrawElements in a loop even with a small
> number of elements cause the same issue.
>
> This is almost certainly a bug in the driver, but I am wondering if anyone
> has a workaround that can be done at the OSG level.
>
> Thanks
>

You can use mesa instead when running under RDC.

http://www.mesa3d.org, works well and even supports shaders.

If you can create an install specifically for RDC users then you can just
put the mesa version of opengl32.dll in with your app and you are done.

If you need to dynamically chose between mesa/hardware renderer, you'll
need to do some monkeying about though,
either loading osg/opengl via LoadLibrary or you'll have to create a little
launcher program to modify the current PATH so
the mesa dlls are/are not found as appropriate.

BTW, don't try and delay load opengl32. I tried that when I wanted to
dynamically chose the open gl version and it causes odd problems.

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


[osg-users] accessing data structures of objects

2012-05-31 Thread Sergey Kurdakov
Hi John,

>I want to design a way to detect which rendered object user is touching in
the screen.

I would suggest to take a look at existing solutions:

http://www.mvps.org/directx/articles/improved_ray_picking.htm ( it uses DX
but explains an approach )

http://uncommoncode.wordpress.com/2010/09/22/select-objects-with-mouse-in-openscenegraph/

https://github.com/xarray/osgRecipes/blob/master/cookbook/chapter3/ch03_06/select_model.cpp(
example fromOpenSceneGraph 3 Cookbook)

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


Re: [osg-users] Enabling notifications from within program?

2012-05-31 Thread Preet
Hi Robert,

That's what I'm currently doing (ie using stack traces to try and
figure stuff out), but I was wondering why osg doesn't give me *any*
output at all. For instance, I'm apparently able to do a bunch of
stuff: Load an *.osg model, setup an animation path, create nodes,
etc, pretty much all of the scene setup goes fine up until I try to
create the viewer. Doesn't doing any of those things before the viewer
provide output when I've set the notify level to debug? I made sure I
compiled with OSG_DISABLE_NOTIFY (or whatever the exact wording for
that flag was) to allow notifications.

On Thu, May 31, 2012 at 4:57 AM, Robert Osfield
 wrote:
> Hi Preet,
>
> The osg::notify system isn't related to handling of std exceptions
> except where some specific code might catch an exception and report
> the output to osg::notify.  This means that upping the notify level
> won't effect how exceptions are handled.
>
> The best thing to do is run a debugger and the look at the stack trace
> where the application crashes.
>
> Robert.
>
> On 31 May 2012 07:57, Preet  wrote:
>> Hiya,
>>
>> I'm trying to debug a std::bad_alloc() exception from osg that doesn't
>> product any other output. I can't set environment variables, so I
>> tried:
>> osg::setNotifyLevel(osg::DEBUG_INFO);
>>
>> This still doesn't give me any output. The system I'm on dumps stdout
>> and stderr to a log file in a specific directory and since Notify.cpp
>> dumps to both of those it seems like I should be seeing something, but
>> I'm not. However, I do get statements like "std::cout << "Hello" <<
>> std::endl" outputted as expected when used in my application (just not
>> from osg). Am I missing something obvious?
>>
>> Preet
>> ___
>> 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] Building a slimmed down static version of OSG

2012-05-31 Thread Preet
Quick follow up:

The error seems to occur when linking using GCC 4.4.2, which is part
of the tool chain I use. When I use my distro's GCC 4.7 to do a static
build with the same CMake settings, I don't get the error. To get
around it in 4.4.2, I explicitly defined requestRedraw() in
GraphicsWindowEmbedded and had it call
GraphicsWindow::requestRedraw(). I don't know if this creates any new
problems since I still haven't gotten osg working, but it looks like
it shouldn't do anything evil and may be worth changing in source if
someone else can confirm its a bug with older compilers.

Status so far: I can deploy an app with osg to the PlayBook but it
instantly crashes. Right now I'm basically sifting through core dumps
and seeing what else I can do to try and get it to work.


Preet

On Thu, May 31, 2012 at 12:07 PM, Thomas Hogarth
 wrote:
> Hi Preet
>
> Not too sure what exactly your issue is but the error
>
> (.rodata._ZTVN9osgViewer22GraphicsWindowEmbeddedE[_ZTVN9osgViewer22GraphicsWindowEmbeddedE]+0xcc):-1:
> error: undefined reference to `non-virtual thunk to
> osgViewer::GraphicsWindow::requestRedraw()'
>
> Suggests that your osgViewer lib isn't linked or GraphicsWindow.cpp wasn't 
> compiled into your lib.
>
> Setting the windowing system to "None" is correct but it may be that it needs 
> to be set before you run cmake. Look at osgViewers CMakeLists.txt and see how 
> it's done on Android.
>
> Cheers
> Tom
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=47975#47975
>
>
>
>
>
> ___
> 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] accessing data structures of objects

2012-05-31 Thread Chris Hanson
>
> When you load data from a file like an obj using the function
> osgDB::readNodeFile is there any way to access the arrays containing vertex
> coordinates, normal coordinates and texture coordinates associated to the
> object? I want to design a way to detect which rendered object user is
> touching in the screen.
>

  Yes. You'll need to determine what subclass of Node it is, and find the
Geode and Geometry objects. There you will find the actual vertex and such
arrays.


>
> Thank you,
> John
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



-- 
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


[osg-users] accessing data structures of objects

2012-05-31 Thread Gio
Hi,
When you load data from a file like an obj using the function 
osgDB::readNodeFile is there any way to access the arrays containing vertex 
coordinates, normal coordinates and texture coordinates associated to the 
object? I want to design a way to detect which rendered object user is touching 
in the screen.

Thank you,
John

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


[osg-users] [osgPlugins] PNG not being displayed correctly

2012-05-31 Thread Thomas Lerman
I have PNGs that were created with libpng. When I view the with most 
applications, they look great. A black image with a gray line starting in the 
upper & lower right corners, traveling at t 45 degree angle until it hits an 
edge, and finally bounces in the opposite direction. The actual image is 
attached as "test-image.png".

When I view it with "osgviewer --image test-image.png", the image looks like it 
is 25% cropped and zoomed by 400% (the numbers might not be right, that is just 
what it looks like). Any ideas what is wrong? Any fixes for this? Thank you in 
advance for whatever help can be provided.

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




Attachments: 
http://forum.openscenegraph.org//files/test_image_482.png


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


[osg-users] OSG 3.0.1 crash in glDrawElements() under Windows Remote Desktop

2012-05-31 Thread Andrew Cunningham
When running a Windows OSG 3.0.1 application under Windows Remote Desktop the 
OpenGL driver defaults to the (ancient) software MS OpenGL GDI renderer v1.1.  
Unfortunately, I need to make the basics of our app work under RDC.

I am finding that glDrawElements ( called from void DrawElementsUInt::draw) 
crashes every time inside the MS OpenGL driver when given a geometry with say, 
3000 elements. With smaller numbers of elements there are no problems.

This is code that works perfectly when running under accelerated drivers such 
as nVidia/ATI etc. I experimented with breaking up the drawing of elements into 
blocks of size GL_MAX_ELEMENTS_INDICES_WIN with no luck. It seems that repeated 
calls to glDrawElements in a loop even with a small number of elements cause 
the same issue.

This is almost certainly a bug in the driver, but I am wondering if anyone has 
a workaround that can be done at the OSG level.

Thanks

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





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


Re: [osg-users] Building a slimmed down static version of OSG

2012-05-31 Thread Thomas Hogarth
Hi Preet

Not too sure what exactly your issue is but the error

(.rodata._ZTVN9osgViewer22GraphicsWindowEmbeddedE[_ZTVN9osgViewer22GraphicsWindowEmbeddedE]+0xcc):-1:
 
error: undefined reference to `non-virtual thunk to 
osgViewer::GraphicsWindow::requestRedraw()' 

Suggests that your osgViewer lib isn't linked or GraphicsWindow.cpp wasn't 
compiled into your lib.

Setting the windowing system to "None" is correct but it may be that it needs 
to be set before you run cmake. Look at osgViewers CMakeLists.txt and see how 
it's done on Android.

Cheers
Tom

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





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


Re: [osg-users] Advice on scene structuring

2012-05-31 Thread Sergey Polischuk
Hi, Filip

Huge count of unique statesets can have big influence on framerate. Also 
implementing just transform in vertex shader, but still drawing each object 
separately would not help you much.
Dont know how you can implement picking with instanced drawing (may be keep 
another scenegraph with pat's just for intersection testing?), but you can do 
culling yourself for instances:
test each instance transformed bounding box\sphere against view frustum, then 
set visible instances transforms to uniform array and set appropriate instances 
count in primitivesets.

Cheers,
Sergey

31.05.2012, 18:26, "Filip Arlet" :
> Hi,
> I have similar problem. But instanced rendering is not an option, because I 
> want to draw different huge number of objects from time to time. Now I share 
> geometry (can't share Geode because of picking - every object has to be 
> different) between PositionAtitudeTransforms. It's pretty fast, but now I'm 
> trying to implement that transform using vertex shader and the performace is 
> low. I share Program between StateSets and don't do anything odd and it is 
> still slower than using PATs.
> Another thing is bad culling.
>
> So my two questions are:
> 1) Where to start, If I want to do what I have described (one uniform matrix 
> and program)
> 2) Best solution for culling and bounding box problem
> 3) If I manage to use Instanced Drawing, will be a big problem that very 
> large part of DataSet will be outside view ? (ie. can't cull multiple 
> instances in one draw)
>
> Thank you!
>
> Cheers,
> Filip
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=47970#47970
>
> ___
> 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] Advice on scene structuring

2012-05-31 Thread Jordi Torres
Hi Filip,

I don't understand very well why instanced rendering is not an option, but
anyway if you are reaching the limits of your hardware you can make an
extra pass and use a geometry shader to discard instances (something like
it's done in [1]).

Other way is going for a multiresolution strategy like an octree (Wang
Rui's last book has an example though).

Hope it helps,
Cheers.

[1]
http://www.geeks3d.com/20100210/opengl-3-2-geometry-instancing-culling-on-gpu-demo/

2012/5/31 Filip Arlet 

> Hi,
> I have similar problem. But instanced rendering is not an option, because
> I want to draw different huge number of objects from time to time. Now I
> share geometry (can't share Geode because of picking - every object has to
> be different) between PositionAtitudeTransforms. It's pretty fast, but now
> I'm trying to implement that transform using vertex shader and the
> performace is low. I share Program between StateSets and don't do anything
> odd and it is still slower than using PATs.
> Another thing is bad culling.
>
> So my two questions are:
> 1) Where to start, If I want to do what I have described (one uniform
> matrix and program)
> 2) Best solution for culling and bounding box problem
> 3) If I manage to use Instanced Drawing, will be a big problem that very
> large part of DataSet will be outside view ? (ie. can't cull multiple
> instances in one draw)
>
> Thank you!
>
> Cheers,
> Filip
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=47970#47970
>
>
>
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



-- 
Jordi Torres Fabra

gvSIG 3D blog
http://gvsig3d.blogspot.com
Instituto de Automática e Informática Industrial
http://www.ai2.upv.es
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Advice on scene structuring

2012-05-31 Thread Filip Arlet
Hi,
I have similar problem. But instanced rendering is not an option, because I 
want to draw different huge number of objects from time to time. Now I share 
geometry (can't share Geode because of picking - every object has to be 
different) between PositionAtitudeTransforms. It's pretty fast, but now I'm 
trying to implement that transform using vertex shader and the performace is 
low. I share Program between StateSets and don't do anything odd and it is 
still slower than using PATs.
Another thing is bad culling.

So my two questions are:
1) Where to start, If I want to do what I have described (one uniform matrix 
and program)
2) Best solution for culling and bounding box problem
3) If I manage to use Instanced Drawing, will be a big problem that very large 
part of DataSet will be outside view ? (ie. can't cull multiple instances in 
one draw)

Thank you!

Cheers,
Filip

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





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


Re: [osg-users] OSG fragment shader

2012-05-31 Thread Christian Rumpf
the image processing effect should work in realtime (i.e. blur shading). shall 
I send the texture coordinates from vertex shader into fragment shader or is it 
ok to just use a fragment shader for image processing?

My intenstion:

I have to create a scene where I can freely move my camera. I can either load 
one of the prepared *.osg files OR create some drawables and let them display 
it with osg::Viewer (as I know you just need 5-10 lines for that).

I heard of a method called render-to-texture, but I'm not sure if this is 
efficient for realtime shading.

lg Christian

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





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


Re: [osg-users] Explanation of macros in staticviewer example?

2012-05-31 Thread Robert Osfield
Hi Preet,

On 31 May 2012 08:10, Preet  wrote:
> Hiya,
>
> In the osgstaticviewer.cpp example, there are three sets of macros:
>
> USE_OSGPLUGIN()...
> USE_DOTOSGWRAPPER_LIBRARY()...
> USE_SERIALIZER_WRAPPER_LIBRARY()...
>
> When compiling a static application, how do we know which ones we need
> to include? It seems like they're all related to osgDB with
> USE_OSGPLUGIN corresponding to plugins. I'm not sure what the other
> two are for.

Only the application developer will know what features there
application requires, so it's really down to you to decide and then
include the components that you require.

If you require old style .osg support then you'll need to included the
osg plugin, and the osg wrapper libraries that will provide the
wrappers for the different osg libs/NodeKits, if you just need the new
.osgt/.osgb/.osgbx support then you'll want to include just the osg
plugin and the serialize wrappers.  If you don't need either then you
can dispense with all these includes.

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


[osg-users] Help:Problem with LineSegmentIntersector. Maybe a bug?

2012-05-31 Thread wang shuiying

Hello,

In osgUtils::LineSegmentIntersector, there is a function "enter()" which 
invokes function " intersects( node.getBound()) ". That serves to check 
whether the LineSegment has intersection with the bounding sphere of the 
node.


However, if I put LineSegmentIntersector into a IntersectionVisitor and 
push a viewMatrix to the intersectionVisitor, which means that the 
linesegment and the traversal node are not defined in reference to  the 
same coordinate system and the transformation is the viewmatrix. Then 
problem occurs. The intersection test might not stand  enter() stage, 
because the lineSegment and the node to be traversed are considered to 
be in the same coordinate system in function  " intersects( 
node.getBound()) ".


As in my program,  the node is defined  in global coordinate, but the 
drawables are far away from the origin.  The LineSegments are defined in 
another coordinate system with start point (0,0,0) and a length of 200. 
Only if I put a drawable at the origin of the global system, the other 
drawables far away from the origin can be detected by the Linesegment, 
or else nothing is detected, though they should be.


Is there something wrong with my application or is that a bug with 
LineSegmentIntersector? I use osg version 3.0.0-2ubuntu1.


Thank you very much in advance!

Best regards

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


Re: [osg-users] Enabling notifications from within program?

2012-05-31 Thread Robert Osfield
Hi Preet,

The osg::notify system isn't related to handling of std exceptions
except where some specific code might catch an exception and report
the output to osg::notify.  This means that upping the notify level
won't effect how exceptions are handled.

The best thing to do is run a debugger and the look at the stack trace
where the application crashes.

Robert.

On 31 May 2012 07:57, Preet  wrote:
> Hiya,
>
> I'm trying to debug a std::bad_alloc() exception from osg that doesn't
> product any other output. I can't set environment variables, so I
> tried:
> osg::setNotifyLevel(osg::DEBUG_INFO);
>
> This still doesn't give me any output. The system I'm on dumps stdout
> and stderr to a log file in a specific directory and since Notify.cpp
> dumps to both of those it seems like I should be seeing something, but
> I'm not. However, I do get statements like "std::cout << "Hello" <<
> std::endl" outputted as expected when used in my application (just not
> from osg). Am I missing something obvious?
>
> Preet
> ___
> 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] [osgOcean] Masked FFTOceanSurface

2012-05-31 Thread Kim Bale
Hi Oliver,

Any chance you could send me the modified files so I can run it and get a
feel for it?

Cheers,

Kim.

On 30 May 2012 13:32, Oliver Neumann  wrote:

> Hi,
>
> I added a user-definable mask functionallity to FFTOceanSurface. The mask
> applies a height offset to the ocean tiles which allows the usage of the
> FFTOceanSurface as rivers and lakes on different altitudes in the same
> scene without having it protrude the ground (I plan to combine this with
> osgEarth).
>
> Its currently more of a dirty hack, but still its quite usable.
>
> In the FFTOceanSurface Header I added 2 variables and changed the ctor:
>
> Code:
>
> osg::Image *_surfMask;
> float _sufMaskMaxDist;
>
> public:
> FFTOceanSurface(unsigned int FFTGridSize = 64,
>  unsigned int resolution = 256,
>  unsigned int numTiles = 17,
>  const osg::Vec2f& windDirection = osg::Vec2f(1.1f, 1.1f),
>  float windSpeed = 12.f,
>  float depth = 1000.f,
>  float reflectionDamping = 0.35f,
>  float waveScale = 1e-8f,
>  bool isChoppy = true,
>  float choppyFactor = -2.5f,
>  float animLoopTime = 10.f,
>  unsigned int numFrames = 256,
>  osg::Image *_surfMask=NULL,
>  float _sufMaskMaxDist=100.0f
> );
>
>
>
>
> In FFTOceanSurface.cpp I added this to the computeSea method:
>
> Before the frame loop:
>
> Code:
>
> int imgDim = 0;
> int imgBytesPerLine = 0;
> int imgBytePerPixel = 0;
>
> if(_surfMask)
> {
>  imgDim =__min(_surfMask->s(),_surfMask->t());
>  imgBytePerPixel =
> _surfMask->computeNumComponents(_surfMask->getPixelFormat());
>  imgBytesPerLine = _surfMask->s()*imgBytePerPixel;
> }
>
>
>
>
> Within the frame loop before calling OceanTile() for level 0:
>
>
> Code:
>
> int sizeHeights = heights->size();
> int dimHeights = (int)floor(sqrt((float)sizeHeights)+0.5f);
>
> if(_surfMask && imgDim>0 && dimHeights>0) // Apply surface mask
> {
>  //Handle scaling difference between
>  if(dimHeights >= imgDim)
>  {
>int imgScaling = dimHeights/imgDim;
>int scaledImgDim = imgDim*imgScaling;
>for(int y= 0; y < dimHeights;y++)
>{
>  int yRow = dimHeights*y;
>  unsigned char* pImgOsgLine = ((unsigned char*)_surfMask->data())+
> imgBytesPerLine * (y/imgScaling);
>  for(int x = 0; x < dimHeights;x++)
>  {
>if((x < scaledImgDim) &&(y < scaledImgDim))
>{
>  float alpha =(float)*((unsigned
> char*)(pImgOsgLine+(x/imgScaling)*imgBytePerPixel))/255.0f;
>  float oldVal = heights->at(yRow+x);
>  heights->at(yRow+x) = alpha*oldVal - _sufMaskMaxDist*(1.0f-alpha);
>}
>else
>{
>  heights->at(yRow+x) = -_sufMaskMaxDist;
>}
>  }
>}
>  }
>  else
>  {
>int imgScaling_d1 = imgDim/dimHeights;
>int scaledImgDim = imgDim/imgScaling_d1;
>for(int y= 0; y < dimHeights;y++)
>{
>  int yRow = dimHeights*y;
>  unsigned char* pImgOsgLine = ((unsigned char*)_surfMask->data()) +
> imgBytesPerLine * y*imgScaling_d1;
>  for(int x = 0; x < dimHeights;x++)
>  {
>if((x < scaledImgDim) &&(y < scaledImgDim) )
>{
>  float alpha =(float)*((unsigned
> char*)(pImgOsgLine+x*imgScaling_d1*imgBytePerPixel))/255.0f;
>  float oldVal = heights->at(yRow+x);
>  heights->at(yRow+x) = alpha*oldVal - _sufMaskMaxDist*(1.0f-alpha);
>}
>else
>{
>  heights->at(yRow+x) = -_sufMaskMaxDist;
>}
>  }
>}
>  }
> }
>
>
>
>
> Greetings,
> Oliver
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=47939#47939
>
>
>
>
> Attachments:
> http://forum.openscenegraph.org//files/ocean_masked_157.png
>
>
> ___
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



-- 
osgOcean - http://code.google.com/p/osgocean/
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Explanation of macros in staticviewer example?

2012-05-31 Thread Preet
Hiya,

In the osgstaticviewer.cpp example, there are three sets of macros:

USE_OSGPLUGIN()...
USE_DOTOSGWRAPPER_LIBRARY()...
USE_SERIALIZER_WRAPPER_LIBRARY()...

When compiling a static application, how do we know which ones we need
to include? It seems like they're all related to osgDB with
USE_OSGPLUGIN corresponding to plugins. I'm not sure what the other
two are for.


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