Re: [osg-users] OSG 3.2.1 + OculusViewer on Mac OSX 10.9 - Crash

2014-09-04 Thread Patrik Andersson
You need to run your application i debug mode, and trace the stack:

0   com.apple.driver.AppleIntelHD5000GraphicsGLDriver 0x1234003a5708
IntelVertexArray::setElemData(unsigned int, unsigned int, unsigned short,
unsigned int) + 140
1   com.apple.driver.AppleIntelHD5000GraphicsGLDriver 0x1234003a5667
IntelVertexArray::extractState(GLDVertexArrayDataRec const*, unsigned long
long) + 81
2   libGPUSupportMercury.dylib 0x7fff9118d6b6
gpusLoadCurrentVertexArray + 188
3   com.apple.driver.AppleIntelHD5000GraphicsGLDriver 0x1234003a3227
updateDispatch + 1355
4   GLEngine   0x7fff9aecf2a0 gleDoDrawDispatchCore
+ 502
5   GLEngine   0x7fff9ae76712
gleSetupAndDrawArraysOrElementsOutOfLine_ListExec + 841
6   GLEngine   0x7fff9ae0bc91 gleCallList + 165
7   libosgUtil.100.dylib   0x00010e8bea59
osgUtil::RenderLeaf::render(osg::RenderInfo&, osgUtil::RenderLeaf*) + 181
8   libosgUtil.100.dylib   0x00010e8bb665
osgUtil::RenderBin::drawImplementation(osg::RenderInfo&,
osgUtil::RenderLeaf*&) + 309
9   libosgUtil.100.dylib   0x00010e8c2e27
osgUtil::RenderStage::drawImplementation(osg::RenderInfo&,
osgUtil::RenderLeaf*&) + 709
10  libosgUtil.100.dylib   0x00010e8c1f31
osgUtil::RenderStage::drawInner(osg::RenderInfo&, osgUtil::RenderLeaf*&,
bool&) + 293
11  libosgUtil.100.dylib   0x00010e8c28c8
osgUtil::RenderStage::draw(osg::RenderInfo&, osgUtil::RenderLeaf*&) + 1058
12  libosgUtil.100.dylib   0x00010e8ca724
osgUtil::SceneView::draw() + 938
13  libosgViewer.100.dylib 0x00010e789396
osgViewer::Renderer::draw() + 856
14  libosg.100.dylib   0x00010e417673
osg::GraphicsContext::runOperations() + 185
15  libosg.100.dylib   0x00010e456325
osg::OperationThread::run() + 413
16  libosg.100.dylib   0x00010e419e31
osg::GraphicsThread::run() + 89
17  libOpenThreads.20.dylib   0x00010e39ebc2
OpenThreads::ThreadPrivateActions::StartThread(void*) + 178
18  libsystem_pthread.dylib   0x7fff9924a899 _pthread_body + 138
19  libsystem_pthread.dylib   0x7fff9924a72a _pthread_start + 137
20  libsystem_pthread.dylib   0x7fff9924efc9 thread_start + 13

I think + ### is the line number in corresponding cpp file.

Kind regards
Patrik


On Thu, Sep 4, 2014 at 5:01 PM, Felipe Ramos  wrote:

> Patrik,
>
> I tried to change to change the code you suggested and still get the crash
> when executing my program, but I don't know exactly what to do... Could you
> please give me more information about what actions I need to take?
> I changed some lines of the code (oculusdevice.cpp) and recompiled the lib.
> The source code and some images are attached to this message.
> Thanks in advance!
>
>
>
> Regards,
> Felipe
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=60952#60952
>
>
>
>
> ___
> 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] Help: how to send non-filtered sampler2Drect to fragment shader?

2014-09-04 Thread shuiying Wang

On 09/04/2014 09:07 PM, osg-users-requ...@lists.openscenegraph.org wrote:

OpenGL filtering of texture is controlled using the Texture::setFilter(..)
method.

The osg::Image settings only related to storage of the data, not filtering
done by OpenGL.

Could it be that your texelFetch(..) function in your GLSL is doing
filtering?

--

As a general note of using the mailing list for support, could you avoid
replying to digest posts as this breaks the threading done by mail clients
so that your reply no longer gets associated with the original thread.  I
find that modern mail clients are good at automatically managing the volume
of traffic from mailing lists so there shouldn't really be a need to use
the digest options.

Robert.

Robert.


Hi Robert,

Thanks!

Sorry I forget about how to use this mailing list.

I just searched in the internet. And I find that texelFetch does not 
have any interpolation.


So I still have no idea.

Shuiying

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


Re: [osg-users] osg-users Digest, Vol 87, Issue 7

2014-09-04 Thread Robert Osfield
HI Shuiying,


On 4 September 2014 17:16, shuiying Wang  wrote:

> Hi,
>
> Thanks!
>
> I tried that a moment ago. The results are still filtered.
>
> What about  the internal mode of the image?
>
> There are just so many of them.
>

OpenGL filtering of texture is controlled using the Texture::setFilter(..)
method.

The osg::Image settings only related to storage of the data, not filtering
done by OpenGL.

Could it be that your texelFetch(..) function in your GLSL is doing
filtering?

--

As a general note of using the mailing list for support, could you avoid
replying to digest posts as this breaks the threading done by mail clients
so that your reply no longer gets associated with the original thread.  I
find that modern mail clients are good at automatically managing the volume
of traffic from mailing lists so there shouldn't really be a need to use
the digest options.

Robert.

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


Re: [osg-users] osg-users Digest, Vol 87, Issue 7

2014-09-04 Thread shuiying Wang

Hi,

Thanks!

I tried that a moment ago. The results are still filtered.

What about  the internal mode of the image?

There are just so many of them.

Shuiying

On 09/04/2014 02:15 PM, osg-users-requ...@lists.openscenegraph.org wrote:

Message: 10
Date: Thu, 4 Sep 2014 14:15:52 +0200
From: Christian Buchner
To: OpenSceneGraph Users
Subject: Re: [osg-users] Help: how to send non-filtered sampler2Drect
to fragment shader?
Message-ID:

Content-Type: text/plain; charset="utf-8"

Hi,

have you tried also setting the minification filter to NEAREST?

osg::Texture2D::MIN_FILTER


Christian



2014-09-04 13:14 GMT+02:00 shuiying Wang:


>  Hello,
>
>I would like the fragment shader to read values from a uniform
>sampler2DRect.
>
>The sampler2DRect stores some data that I want to give to the shader.
>
>The problem is  that the shader always gets filtered value of the actual
>data. I want the shader to get the exact value without any filtering.
>
>I use the following binding method and shader programming:
>
>//set image
>
>osg::ref_ptr imageSampler = new osg::Image();
>
>
>imageSampler->allocateImage((int)XRes, (int)YRes, 1, GL_RGBA, GL_FLOAT);
>
>osg::Vec4f * rgba = (osg::Vec4f *)(imageSampler->data());
>
>  // write date to the image
>
>for (int row = 0; row < subYRes; row++) {
>
> for (int column = 0; column < subXRes;
>   <
>span style="color:rgb(0,0,0)">column++) {
>
>*rgba = osg::Vec4f(data, data, 
0, 0);
>
> rgba++;
>
>}
>
>  }
>
>// texture for sampler
>
>osg::ref_ptr textureRect = new osg::TextureRectangle;
>textureRect->setTextureSize((int)subXRes, (int)subYRes);
>textureRect->setInternalFormat(GL_RGBA);
>textureRect->setImage(0, 
imageSampler);textureRect->setFilter(osg::Texture2D::MAG_FILTER, 
osg::Texture2D::NEAREST);
>// configure  shader
>
>stateset->addUniform(new osg::Uniform("textureID0", 0));
>
>stateset->setTextureAttributeAndModes(0, textureRect, osg::StateAttribute::ON);
>
>// in fragment shader:
>
>uniform sampler2DRect textureID0;
>
>
>void main()
>
>{
>
> vec2 st=vec2(gl_FragCoord.x -0.5,gl_FragCoord.y-0.5);
>
> vec4 rgba = texelFetch(textureID0, ivec2(st));
>
> Frag_Color = vec4(rgba.r,rgba.g,0,0);
>}
>
>If I read the frame buffer, the value of rgba.r and rgba.g seem to be filtered 
value, not exactly what the real value.
>
>Where I am wrong here ?
>
>Thanks a lot!
>
>Best wishes
>Shuiying
>


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


Re: [osg-users] OSG 3.2.1 + OculusViewer on Mac OSX 10.9 - Crash

2014-09-04 Thread Patrik Andersson
The error is similar to one which I had with the API. You could check in
oculusdevice.cpp, if the position array is 3 dimensional instead of 2?
Similar check that the update the shaderprogram to let the position be a
Vec3 instead of Vec2.

Kind regards
Patrik


On Thu, Sep 4, 2014 at 3:18 PM, Felipe Ramos  wrote:

> Hi,
>
> I'm having some trouble trying to integrate OSG (3.2.1) with Oculus Rift
> (SDK 0.4.1) using OculusViewer library. I'm using Mac OS X 10.9 (Mavericks)
> and Xcore (5.1).
> I can compile my code without any problem, but when I try to run it
> crashes. Here is a small of the log where the crash occurs (the complete
> log is attached to this message):
>
> Thread 7 Crashed:
> 0   com.apple.driver.AppleIntelHD5000GraphicsGLDriver   0x1234003a5708
> IntelVertexArray::setElemData(unsigned int, unsigned int, unsigned short,
> unsigned int) + 140
> 1   com.apple.driver.AppleIntelHD5000GraphicsGLDriver   0x1234003a5667
> IntelVertexArray::extractState(GLDVertexArrayDataRec const*, unsigned long
> long) + 81
> 2   libGPUSupportMercury.dylib  0x7fff9118d6b6
> gpusLoadCurrentVertexArray + 188
> 3   com.apple.driver.AppleIntelHD5000GraphicsGLDriver   0x1234003a3227
> updateDispatch + 1355
> 4   GLEngine0x7fff9aecf2a0
> gleDoDrawDispatchCore + 502
> 5   GLEngine0x7fff9ae76712
> gleSetupAndDrawArraysOrElementsOutOfLine_ListExec + 841
> 6   GLEngine0x7fff9ae0bc91 gleCallList +
> 165
> 7   libosgUtil.100.dylib0x00010e8bea59
> osgUtil::RenderLeaf::render(osg::RenderInfo&, osgUtil::RenderLeaf*) + 181
> 8   libosgUtil.100.dylib0x00010e8bb665
> osgUtil::RenderBin::drawImplementation(osg::RenderInfo&,
> osgUtil::RenderLeaf*&) + 309
> 9   libosgUtil.100.dylib0x00010e8c2e27
> osgUtil::RenderStage::drawImplementation(osg::RenderInfo&,
> osgUtil::RenderLeaf*&) + 709
> 10  libosgUtil.100.dylib0x00010e8c1f31
> osgUtil::RenderStage::drawInner(osg::RenderInfo&, osgUtil::RenderLeaf*&,
> bool&) + 293
> 11  libosgUtil.100.dylib0x00010e8c28c8
> osgUtil::RenderStage::draw(osg::RenderInfo&, osgUtil::RenderLeaf*&) + 1058
> 12  libosgUtil.100.dylib0x00010e8ca724
> osgUtil::SceneView::draw() + 938
> 13  libosgViewer.100.dylib  0x00010e789396
> osgViewer::Renderer::draw() + 856
> 14  libosg.100.dylib0x00010e417673
> osg::GraphicsContext::runOperations() + 185
> 15  libosg.100.dylib0x00010e456325
> osg::OperationThread::run() + 413
> 16  libosg.100.dylib0x00010e419e31
> osg::GraphicsThread::run() + 89
> 17  libOpenThreads.20.dylib 0x00010e39ebc2
> OpenThreads::ThreadPrivateActions::StartThread(void*) + 178
> 18  libsystem_pthread.dylib 0x7fff9924a899 _pthread_body +
> 138
> 19  libsystem_pthread.dylib 0x7fff9924a72a _pthread_start
> + 137
> 20  libsystem_pthread.dylib 0x7fff9924efc9 thread_start +
> 13
>
> Can anyone help me to solve this? I don't know how to fix it...
>
> Thank you!
>
> Cheers,
> Felipe
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=60950#60950
>
>
>
>
> ___
> 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] OSG 3.2.1 + OculusViewer on Mac OSX 10.9 - Crash

2014-09-04 Thread Felipe Ramos
Hi,

I'm having some trouble trying to integrate OSG (3.2.1) with Oculus Rift (SDK 
0.4.1) using OculusViewer library. I'm using Mac OS X 10.9 (Mavericks) and 
Xcore (5.1).
I can compile my code without any problem, but when I try to run it crashes. 
Here is a small of the log where the crash occurs (the complete log is attached 
to this message):

Thread 7 Crashed:
0   com.apple.driver.AppleIntelHD5000GraphicsGLDriver   0x1234003a5708 
IntelVertexArray::setElemData(unsigned int, unsigned int, unsigned short, 
unsigned int) + 140
1   com.apple.driver.AppleIntelHD5000GraphicsGLDriver   0x1234003a5667 
IntelVertexArray::extractState(GLDVertexArrayDataRec const*, unsigned long 
long) + 81
2   libGPUSupportMercury.dylib  0x7fff9118d6b6 
gpusLoadCurrentVertexArray + 188
3   com.apple.driver.AppleIntelHD5000GraphicsGLDriver   0x1234003a3227 
updateDispatch + 1355
4   GLEngine0x7fff9aecf2a0 
gleDoDrawDispatchCore + 502
5   GLEngine0x7fff9ae76712 
gleSetupAndDrawArraysOrElementsOutOfLine_ListExec + 841
6   GLEngine0x7fff9ae0bc91 gleCallList + 165
7   libosgUtil.100.dylib0x00010e8bea59 
osgUtil::RenderLeaf::render(osg::RenderInfo&, osgUtil::RenderLeaf*) + 181
8   libosgUtil.100.dylib0x00010e8bb665 
osgUtil::RenderBin::drawImplementation(osg::RenderInfo&, osgUtil::RenderLeaf*&) 
+ 309
9   libosgUtil.100.dylib0x00010e8c2e27 
osgUtil::RenderStage::drawImplementation(osg::RenderInfo&, 
osgUtil::RenderLeaf*&) + 709
10  libosgUtil.100.dylib0x00010e8c1f31 
osgUtil::RenderStage::drawInner(osg::RenderInfo&, osgUtil::RenderLeaf*&, bool&) 
+ 293
11  libosgUtil.100.dylib0x00010e8c28c8 
osgUtil::RenderStage::draw(osg::RenderInfo&, osgUtil::RenderLeaf*&) + 1058
12  libosgUtil.100.dylib0x00010e8ca724 
osgUtil::SceneView::draw() + 938
13  libosgViewer.100.dylib  0x00010e789396 
osgViewer::Renderer::draw() + 856
14  libosg.100.dylib0x00010e417673 
osg::GraphicsContext::runOperations() + 185
15  libosg.100.dylib0x00010e456325 
osg::OperationThread::run() + 413
16  libosg.100.dylib0x00010e419e31 
osg::GraphicsThread::run() + 89
17  libOpenThreads.20.dylib 0x00010e39ebc2 
OpenThreads::ThreadPrivateActions::StartThread(void*) + 178
18  libsystem_pthread.dylib 0x7fff9924a899 _pthread_body + 138
19  libsystem_pthread.dylib 0x7fff9924a72a _pthread_start + 137
20  libsystem_pthread.dylib 0x7fff9924efc9 thread_start + 13

Can anyone help me to solve this? I don't know how to fix it...

Thank you!

Cheers,
Felipe

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



Process: OCULUS_VIEWER [2192]
Path:/Users/Shared/*/OCULUS_VIEWER
Identifier:  OCULUS_VIEWER
Version: 0
Code Type:   X86-64 (Native)
Parent Process:  Instruments [2186]
Responsible: Instruments [2186]
User ID: 501

Date/Time:   2014-09-04 08:58:45.847 -0300
OS Version:  Mac OS X 10.9.4 (13E28)
Report Version:  11
Anonymous UUID:  69A3DC14-618B-262D-0D5B-366F6CD3F7DA

Sleep/Wake UUID: 8C3657D6-7D46-4966-A82C-729D68A1FF55

Crashed Thread:  7

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x1236003fc7e2

VM Regions Near 0x1236003fc7e2:
__LINKEDIT 123400498000-1234005d4000 [ 1264K] r--/rwx 
SM=COW  
/System/Library/Extensions/AppleIntelHD5000GraphicsGLDriver.bundle/Contents/MacOS/AppleIntelHD5000GraphicsGLDriver
--> 
MALLOC_TINY7fb1e340-7fb1e350 [ 1024K] rw-/rwx 
SM=PRV  

Thread 0:: Dispatch queue: com.apple.main-thread
0   com.apple.CoreFoundation0x7fff8f5e2dec -[__NSArrayM 
removeObjectAtIndex:] + 188
1   com.apple.CoreFoundation0x7fff8f5f2e25 
CFRunLoopRemoveObserver + 181
2   com.apple.AppKit0x7fff9098077c __38-[NSApplication 
setWindowsNeedUpdate:]_block_invoke2437 + 121
3   com.apple.CoreFoundation0x7fff8f5f2d67 
__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
4   com.apple.CoreFoundation0x7fff8f5f2cd7 
__CFRunLoopDoObservers + 391
5   com.apple.CoreFoundation0x7fff8f5e43b8 __CFRunLoopRun + 776
6   com.apple.CoreFoundation0x7fff8f5e3e75 CFRunLoopRunSpecific 
+ 309
7   com.apple.HIToolbox 0x7fff99ab7a0d 
RunCurrentEventLoopInMode + 226
8   com.apple.HIToolbox 0x7fff99ab7685 
ReceiveNextEventCommon + 173
9   com.apple.HIToolbox 0x7fff99ab75bc 
_BlockUntilNextEventMatchingListInModeWithFilter + 65
10  com.apple.AppKit0x7fff905e924e _DPSNextEvent + 1434
11  com.apple.AppK

Re: [osg-users] Help: how to send non-filtered sampler2Drect to fragment shader?

2014-09-04 Thread Christian Buchner
Hi,

have you tried also setting the minification filter to NEAREST?

osg::Texture2D::MIN_FILTER


Christian



2014-09-04 13:14 GMT+02:00 shuiying Wang :

>  Hello,
>
> I would like the fragment shader to read values from a uniform
> sampler2DRect.
>
> The sampler2DRect stores some data that I want to give to the shader.
>
> The problem is  that the shader always gets filtered value of the actual
> data. I want the shader to get the exact value without any filtering.
>
> I use the following binding method and shader programming:
>
> //set image
>
> osg::ref_ptr imageSampler = new osg::Image();
>
>
> imageSampler->allocateImage((int)XRes, (int)YRes, 1, GL_RGBA, GL_FLOAT);
>
> osg::Vec4f * rgba = (osg::Vec4f *)(imageSampler->data());
>
>  // write date to the image
>
> for (int row = 0; row < subYRes; row++) {
>
> for (int column = 0; column < subXRes;
>   <
> span style="color:rgb(0,0,0)">column++) {
>
>*rgba = osg::Vec4f(data, data, 
> 0, 0);
>
> rgba++;
>
>}
>
>  }
>
> // texture for sampler
>
> osg::ref_ptr textureRect = new osg::TextureRectangle;
> textureRect->setTextureSize((int)subXRes, (int)subYRes);
> textureRect->setInternalFormat(GL_RGBA);
> textureRect->setImage(0, 
> imageSampler);textureRect->setFilter(osg::Texture2D::MAG_FILTER, 
> osg::Texture2D::NEAREST);
> // configure  shader
>
> stateset->addUniform(new osg::Uniform("textureID0", 0));
>
> stateset->setTextureAttributeAndModes(0, textureRect, 
> osg::StateAttribute::ON);
>
> // in fragment shader:
>
> uniform sampler2DRect textureID0;
>
>
> void main()
>
> {
>
> vec2 st=vec2(gl_FragCoord.x -0.5,gl_FragCoord.y-0.5);
>
> vec4 rgba = texelFetch(textureID0, ivec2(st));
>
> Frag_Color = vec4(rgba.r,rgba.g,0,0);
> }
>
> If I read the frame buffer, the value of rgba.r and rgba.g seem to be 
> filtered value, not exactly what the real value.
>
> Where I am wrong here ?
>
> Thanks a lot!
>
> Best wishes
> Shuiying
>
>
>
>
> ___
> 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] Help: how to send non-filtered sampler2Drect to fragment shader?

2014-09-04 Thread shuiying Wang

Hello,

I would like the fragment shader to read values from a uniform 
sampler2DRect.


The sampler2DRect stores some data that I want to give to the shader.

The problem is  that the shader always gets filtered value of the actual 
data. I want the shader to get the exact value without any filtering.


I use the following binding method and shader programming:

//set image

osg::ref_ptr  imageSampler  =  new  osg::Image();


imageSampler->allocateImage((int)XRes,  (int)YRes,  1,  GL_RGBA,  GL_FLOAT);


osg::Vec4f  *  rgba  =  (osg::Vec4f  *)(imageSampler->data());



// write date to the image


for  (int  row  =  0;  row  <  subYRes;  row++)  {


for  (int  column  =  0;  column  <  subXRes;  column++)  {


   


*rgba  =  osg::Vec4f(data,  data,  0,  0);


rgba++;

   }



}


// texture for sampler


osg::ref_ptr  textureRect  =  new  osg::TextureRectangle;

textureRect->setTextureSize((int)subXRes,  (int)subYRes);

textureRect->setInternalFormat(GL_RGBA);

textureRect->setImage(0,  imageSampler);
textureRect->setFilter(osg::Texture2D::MAG_FILTER,  osg::Texture2D::NEAREST);


// configure  shader

stateset->addUniform(new  osg::Uniform("textureID0",  0));


stateset->setTextureAttributeAndModes(0,  textureRect,  
osg::StateAttribute::ON);



// in fragment shader:

uniform  sampler2DRect  textureID0;

void  main()


{



vec2  st=vec2(gl_FragCoord.x  -0.5,gl_FragCoord.y-0.5);


vec4  rgba  =  texelFetch(textureID0,  ivec2(st));


Frag_Color  =  vec4(rgba.r,rgba.g,0,0);
}

If I read the frame buffer, the value of rgba.r and rgba.g seem to be filtered 
value, not exactly what the real value.

Where I am wrong here ?

Thanks a lot!

Best wishes
Shuiying




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


Re: [osg-users] Event handlers works in DEBUG-mode but not RELEASE mode

2014-09-04 Thread Patrik Andersson
Thank you for your replies. I think the minimal code to recreate this
problem is:

osg::Camera * createCameraFunction(...) {
osg::ref_ptr camera = new osg::Camera;
// do some stuff
camera->setAllowEventFocus(false);
return camera.release();
}

void anotherFunction() {
osg::ref_ptr camera = createCameraFunction(...);
camera->setAllowEventFocus(true);

a_view->setCamera(camera);
// Add some event handlers...
a_view->addEventHandler(...);
}

When I change the setAllowEventFocus(false) in createCameraFunction to
setAllowEventFocus(true) and remove that line in anotherFunction the issue
was resolved.
So somewhere the setAllowEventFocus was not applied correctly during
release mode, but since debug mode is less sensitive it worked out in that
mode.




On Thu, Sep 4, 2014 at 11:55 AM, Robert Osfield 
wrote:

> HI Patrik,
>
> I would suspect a build problem somewhere along route, be it in how you
> have built the OSG or your own application.
>
> Robert.
>
>
> On 4 September 2014 09:43, Patrik Andersson  > wrote:
>
>> Hi,
>>
>> In the project I'm working in, we have discovered an inconsistent
>> behavior of the event system. In debug mode, the event handlers works as
>> expected but when we change to release mode they does not work.
>> The strange is that it has worked before. The input is the same as I can
>> see.
>>
>> What could cause such a behavior?
>>
>> Kind regards
>>
>> Patrik
>>
>> ___
>> 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] Event handlers works in DEBUG-mode but not RELEASE mode

2014-09-04 Thread Robert Osfield
HI Patrik,

I would suspect a build problem somewhere along route, be it in how you
have built the OSG or your own application.

Robert.


On 4 September 2014 09:43, Patrik Andersson 
wrote:

> Hi,
>
> In the project I'm working in, we have discovered an inconsistent behavior
> of the event system. In debug mode, the event handlers works as expected
> but when we change to release mode they does not work.
> The strange is that it has worked before. The input is the same as I can
> see.
>
> What could cause such a behavior?
>
> Kind regards
>
> Patrik
>
> ___
> 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] Event handlers works in DEBUG-mode but not RELEASE mode

2014-09-04 Thread Sebastian Messerschmidt

Hi Patrik,

can you provide a minimal working example to show that behaviour? I 
seriously doubt that there is a problem in the osg code. My guess would 
be that you forgot to initialize variables.

Also could you state which platform and osg version you are using.

Cheers
Sebastian


Hi,

In the project I'm working in, we have discovered an inconsistent 
behavior of the event system. In debug mode, the event handlers works 
as expected but when we change to release mode they does not work.
The strange is that it has worked before. The input is the same as I 
can see.


What could cause such a behavior?

Kind regards

Patrik


___
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] Event handlers works in DEBUG-mode but not RELEASE mode

2014-09-04 Thread Patrik Andersson
Hi,

In the project I'm working in, we have discovered an inconsistent behavior
of the event system. In debug mode, the event handlers works as expected
but when we change to release mode they does not work.
The strange is that it has worked before. The input is the same as I can
see.

What could cause such a behavior?

Kind regards

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


Re: [osg-users] Is setCullMask thread-safe?

2014-09-04 Thread Konstantin
Thank you, Robert!

viewer.addUpdateOperation(operation) is the most pleasant solution!


KOS



2014-08-28 13:13 GMT+04:00 Robert Osfield :

> HI Konstantin,
>
>
> On 28 August 2014 09:06, Konstantin  wrote:
>
>> Can I call setCullMask for viewer's camera from the other thread while
>> viewer is running?
>>
>
> There isn't any mutex around the set/get of a the Camera::CullMask, but it
> is just a unsigned int so as long as the camera isn't deleted by one the
> threads all the threads we will contending over will be the value of the
> CullMask.  All the CullMask affects is the traversal - if it's wrong then
> you'd see the wrong parts of the scene graph traversed and this could be in
> an inconherent way - for instance half the cull traversal might use one
> mask and the other half use the new value that was set by the other
> thread.  This is the worst that can happen though, you won't get a crash.
>
> The completely safe and reasonable way to set things like the
> Camera::CullMask is in the update phase of the frame.  Cueing up Operation
> objects to do the operations on the scene graph in a thread safe container
> is one way of managing this - the Viewer has the OperationQueue for just
> this purpose - just add an operation via
> viewer.addUpdateOperation(operation) and it'll be called automatically for
> you, you just need to subclass from Operation and get it to do the dirty
> work for you.
>
> Robert.
>
> ___
> 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] Warped scene with two sets of Geodes

2014-09-04 Thread Robert Osfield
Hi Ben,


On 3 September 2014 22:55, Ben Morgan  wrote:

> Hi Robert,
>
> I found out what the Problem was--it *was* my code :-)
> In particular, it looks like mixing doubles and floats is very bad.
>
> Pretty much everything is a float except for the vertex array of a street.
> If I change that to float and convert the Points to Vec3 instead of
> Vec3d, then everything is good.
> Do you understand why this is a problem though?
>

I can only provide a guess, and that would be that the Intel OpenGL doesn't
handle double vertex data correctly, so you are stumbling across a driver
bug.

In general OpenGL hardware is based around floating point maths so the
drivers normally convert any double data you pass it into floats before
passing it to the GPU. Even if the driver does this correctly this
conversion process slows performance down so it's best to keep
osg::Geometry vertex/texcoord/normal etc. data all in float arrays such as
Vec3Array.

You can retain precision by translating your data to a local origin prior
to conversion to float then place a MatrixTransform above your data to
place it in the correct 3D position.  The OSG by default uses double for
all internal matrices that that when it accumulates the modelvew matrix
during the cull traversal double precision is maintain for as long as
possible before passing the final modelview matrix to OpenGL.  Using this
technique the OSG can handle whole earth data without any jitter/precision
problems.

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