Re: [osg-users] Errors when using shaders

2014-06-24 Thread ying song
Hi Robert,

Yes, you are right! It's the problem of my driver. I installed a new driver, 
and the problem is gone now.

Thank you!!

Cheers,
ying

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





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


Re: [osg-users] GraphicsWindowCocoa Sample

2014-06-24 Thread Stephan Maximilian Huber
Hi Yu,

here’s a snippet of an app using osg inside a classic Cocoa-app. The trick is 
to let osg create a view only and then add this view into your 
NSView-hierarchy. 

osg::ref_ptrosgViewer::GraphicsWindowCocoa::WindowData win_data = new 
osgViewer::GraphicsWindowCocoa::WindowData(
osgViewer::GraphicsWindowCocoa::WindowData::CreateOnlyView |
osgViewer::GraphicsWindowCocoa::WindowData::CheckForEvents
);

// self is a NSWindow/NSView

osg::ref_ptrosg::GraphicsContext::Traits traits = new 
osg::GraphicsContext::Traits();
traits-inheritedWindowData = win_data;
traits-x = 0;
traits-y = 0;
traits-width = [self frame].size.width;
traits-height = [self frame].size.height;
traits-doubleBuffer = true;
traits-vsync = true;
traits-windowDecoration = false;
traits-supportsResize = false;

// the following steps are deep inside my own app and it’s to cumbersome to 
quote them here. 
// 1. create the graphics-context with the traits-object
// 2. create a osg::Viewer or a osg::View and set the gc accordingly.
// 3. realize the graphics-context
// 4. after realizing the GraphicsContext you can get the created view via the 
win_data-object.


openglView = win_data-getCreatedNSView();
[self addSubview: openglView];

[openglView setFrame: NSMakeRect(0, 0, [self frame].size.width, [self 
frame].size.height)];


Another approach is the usage of GraphicsWindowEmbedded, here you’ll create and 
control the OpenGL graphics-context by yourself. 

HTH,

Stephan


On 20 Jun 2014, at 18:08, Yu Zhang sciro...@163.com wrote:

 Hi Experts,
 
 Could you please provide a OS X sample in using GraphicsWindowCocoa?
 
 I need bind a cocoa window to an osgview.
 
 BTW, the osgviewerCocoa example works, it used setUpViewerAsEmbeddedInWindow 
 and seems only works in single draw/cull thread mode.
 
 I tried 

 osgViewer::GraphicsWindowCocoa::WindowData(osgViewer::GraphicsWindowCocoa::WindowData::PoseAsStandaloneApp);
 
 In a new window and displays the node but hanged, and 
 osgViewer::GraphicsWindowCocoa::WindowData(osgViewer::GraphicsWindowCocoa::WindowData::CreateOnlyView);
  looks not work in my side.
 
 Macbook pro 13 late 1013, OS X 10.9.3 XCode 5.02
 
 Thank you!
 
 Cheers,
 Yu
 
 --
 Read this topic online here:
 http://forum.openscenegraph.org/viewtopic.php?p=59836#59836
 
 
 
 
 
 ___
 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] Last frames modelview matrix

2014-06-24 Thread Pierre Landes
Actually, the modelview matrices I get (from CullVisitor::getModelViewMatrix() 
inside the operator()(Node*, NodeVisitor*) of a cull callback) do seem correct. 
It is just that I may not fully grasp what they actually contain at that point 
in the code. I thus have a couple of additional questions:

1) I have the impression they do not incorporate the viewing transform, and 
hence are just local-to-world matrices at that point. Could you please confirm 
this?
2) What would be a desirable way to retrieve the current viewing transform? 
Would calling 
Code:
cullVisitor-getRenderInfo().getView()-getCamera()-getViewMatrix()

 be a nice way of doing it?
2) My goal is to send the previous frame's modelview and projection matrices to 
my vertex shader via uniforms. Would it make any difference to add such 
uniforms to the stateset of a Geode (via a NodeVisitor) or to add them the 
stateset of a Drawable (via a Drawable::CullCallback), given the fact the 
Drawable has been added to the said Geode? Would it affect the way uniforms are 
uploaded?

Thanks in advance. :)

Cheers.

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





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


Re: [osg-users] [build] How to read the depth value of pixel on screen?

2014-06-24 Thread Robert Osfield
HI Liu,

Do to custom OpenGL calls after the main view has rendered add use a
osg::Camera FinalDrawCallback.  The following OSG examples implement
final draw callbacks so have at look at them for guidance:

~/OpenSceneGraph/examples$ grep FinalDrawCallback */*.cpp
osgatomiccounter/osgatomiccounter.cpp:
viewer.getCamera()-setFinalDrawCallback(drawCallback);
osgautocapture/osgautocapture.cpp:
viewer.getCamera()-setFinalDrawCallback(new
WindowCaptureCallback(buffer, fileName));
osgframerenderer/osgframerenderer.cpp:
camera-setFinalDrawCallback(screenShot.get());
osgframerenderer/osgframerenderer.cpp:
camera-setFinalDrawCallback(screenShot.get());
osghud/osghud.cpp:SnapImage* finalDrawCallback = new
SnapImage(FinalDrawCallback.png);
osghud/osghud.cpp:
viewer.getCamera()-setFinalDrawCallback(finalDrawCallback);
osgscreencapture/osgscreencapture.cpp:
lastCamera-setFinalDrawCallback(callback);
osgscreencapture/osgscreencapture.cpp:
camera-setFinalDrawCallback(new WindowCaptureCallback(mode, position,
readBuffer));

Robert.

On 23 June 2014 19:33, Liu PeiFu lpfx...@163.com wrote:
 Hi,

 ...
 I just want to do the same things as the following code does:
 glReadPixels(e-x(),height()-e-y(),1,1, GL_DEPTH_COMPONENT, GL_FLOAT, 
 gloablewinZ);
  So how can do it in osg?
 Thank you!

 Cheers,
 Liu

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





 ___
 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] zooming is disabling rain and clouds in silverlining

2014-06-24 Thread Frank Kane
Hi,

Keep in mind zoom and field of view (FOV) aren't quite the same thing... that 
first parameter should probably be more like fov / zoom, where typical fov's 
are around 45 degrees. 

I'm pretty sure Sebastian's advice will get you going; lots of people are using 
SilverLining with OSG and lots of different FOV's without trouble. But feel 
free to contact us here at Sundog Software ( http://sundog-soft.com/sds/about/ 
) if you need further assistance. Ideally if you could modify the OSG sample 
application that comes with SilverLining to reproduce your problem, we can look 
into it more easily.

Thank you!

Cheers,
Frank

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





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


Re: [osg-users] Change the camera rotation axis

2014-06-24 Thread Andrés Barrionuevo
Hi Trajce!
Thanks for your help.


I've been browsing the manipulator's source code and found something 
interesting: the SET_CENTER_ON_WHEEL_FORWARD_MOVEMENT flag.

If I understand correctly, having this flag set will make that if zoom in the 
view, the camera will update its position on each scroll.

Wouldn't this do the same as what you suggested, setting the home position?

Now, for whatever the reason it may be, the setCenterByMousePointerIntersection 
function always return false. The intersection test is done with a 
LineSegmentIntersector, but it finds zero intersections.

This has happened to me before when I was trying to achieve point picking, 
following the example in the Beginner's Guide. Changing the 
LineSegmentIntersector to a PolytopeIntersector did the trick.

My camera was created using the setProjectionMatrixAsPerspective method.

... 

Cheers!
Andrés

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





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


Re: [osg-users] zooming is disabling rain and clouds in silverlining

2014-06-24 Thread lawrence wong
Hi Frank and Sebastian,

So i just tested setProjectionMatrixAsPerspective it really worked as 
alternate to makeScale, zooming the scene as expected (but not quite...)

Zooming now does not hide Silverlining's rain and clouds. That's Ok. On the 
other hand, now that i'm altering FOV, it reaches a point when zooming in, 
where the screen flashes due to each raindrop passing in front of the scene. As 
far as i could figure out by observing it, the rain is implemented as thin 
semi-transparent rectangles (raindrop) in a plane so this behavior is kind of 
expected. 

I just did a quick test trying to simulate rain using osg::ImageSequence with a 
couple of .png's resulting in animated droplets and i attached the 
imageSequence to a new osg::Camera and when i zoomed in the scene using FOV it 
solved the problem - the raindrops stayed the original size. I think i could 
use this process to render a windshield wiper swinging side to side now.

There may be a better way to solve this issue with zooming the scene while 
preserving the original rain, i'd gladly implement such a solution! :)

... 

Thank you!

Cheers,
lawrence

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





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


[osg-users] 1st Call for Participation - SIGGRAPH 2014 OSG BOF

2014-06-24 Thread John Richardson
Apologies for duplicates.

 

Hello,

 

Feel free to SHOW OFF your OpenScenegraph appyness, guruness, savy,
groovyness, at SIGGRAPH 2014 on Wednesday Aug 13, 2014.

 

First Come First served.

 

John F. Richardson

 

 

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


Re: [osg-users] Change the camera rotation axis

2014-06-24 Thread Trajce Nikolov NICK
Hi Andres,

I must leave you to your own now and the other from the community that know
the specifics of the trackball code. But want to encourage you to read the
code understand it and maybe do mods based on your need - that is actually
how we all learn osg, by reading it :-). You are definitely on good track.

If you really really get stuck then I might spend some hours to read the
code with you, but this is rather simple so I believe you will find solution

Cheers,
Nick


On Tue, Jun 24, 2014 at 1:14 PM, Andrés Barrionuevo abarrionu...@gmx.com
wrote:

 Hi Trajce!
 Thanks for your help.


 I've been browsing the manipulator's source code and found something
 interesting: the SET_CENTER_ON_WHEEL_FORWARD_MOVEMENT flag.

 If I understand correctly, having this flag set will make that if zoom in
 the view, the camera will update its position on each scroll.

 Wouldn't this do the same as what you suggested, setting the home position?

 Now, for whatever the reason it may be, the
 setCenterByMousePointerIntersection function always return false. The
 intersection test is done with a LineSegmentIntersector, but it finds zero
 intersections.

 This has happened to me before when I was trying to achieve point picking,
 following the example in the Beginner's Guide. Changing the
 LineSegmentIntersector to a PolytopeIntersector did the trick.

 My camera was created using the setProjectionMatrixAsPerspective method.

 ...

 Cheers!
 Andrés

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





 ___
 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] zooming is disabling rain and clouds in silverlining

2014-06-24 Thread Frank Kane

drout wrote:
 now that i'm altering FOV, it reaches a point when zooming in, where the 
 screen flashes due to each raindrop passing in front of the scene. As far as 
 i could figure out by observing it, the rain is implemented as thin 
 semi-transparent rectangles (raindrop) in a plane so this behavior is kind of 
 expected. 


Well yes, if you zoom in that far the raindrops near the camera will also get 
bigger. If you open up the resources/silverlining.config file, you might try 
increasing the value of rain-near-clip a bit in order to reduce that effect. Or 
you could substitute your own image-based effect like you're doing.

This is sort of getting more into SilverLining support and less about OSG at 
this point though. Again feel free to just contact us directly if you need 
further assistance.

Thanks,
Frank

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





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


Re: [osg-users] zooming is disabling rain and clouds in silverlining

2014-06-24 Thread lawrence wong
You're right, i'm going off-topic, sry :-s  I will try to modify that config 
file - that was a very interesting hint, Thank you again!


... 

Thank you!

Cheers,
lawrence ;)

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





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


Re: [osg-users] New scheme for configuring the OSG for building against different versions of the OpenGL/OpenGL ES

2014-06-24 Thread Thomas Hogarth
Hi All

Small bug when configuring for Android on OS X, at the the moment i think the 
fact I'm on iOS is overriding everything

We end up with this in GL header file

#include TargetConditionals.h
#include OpenGLES/ES2/gl.h

We need this

//#include TargetConditionals.h
#include GLES2/gl2.h

I'll try properly fix it asap but if anyone else has missing header issues, 
that's the problem.

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





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