Re: [osg-users] EXTERNAL: Re: Read Image from RTT

2018-09-27 Thread Rowley, Marlin R
Did you allocate storage for your osg::Image* before using it (i.e. osg::Image* 
img = new osg::Image)?  That doesn't make sense why it would only work on a 
osg::ref_ptr. 


Marlin Rowley
Software Engineer, Staff

Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com

-Original Message-
From: osg-users  On Behalf Of 
Rômulo Cerqueira
Sent: Thursday, September 27, 2018 3:34 PM
To: osg-users@lists.openscenegraph.org
Subject: EXTERNAL: Re: [osg-users] Read Image from RTT

Solved the problem!

Perhaps readImageFromCurentTexture() works only with osg::ref_ptr 
instead of osg::Image*.
... 

Thank you!

Cheers,
Rômulo

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





___
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] Read Image from RTT

2018-09-27 Thread Rômulo Cerqueira
Solved the problem!

Perhaps readImageFromCurentTexture() works only with osg::ref_ptr 
instead of osg::Image*.
... 

Thank you!

Cheers,
Rômulo

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





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


Re: [osg-users] EXTERNAL: Re: Read Image from RTT

2018-09-27 Thread Rowley, Marlin R
I just noticed that.  You'll have to check and see what line it's crashing on 
in the debugger.  I just noticed that you get a graphics context but never 
check to see if it's NULL.  A NULL pointer can't access any methods of the 
class it's referring to.

Good Luck!


Marlin Rowley
Software Engineer, Staff

Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com

-Original Message-
From: osg-users  On Behalf Of 
Rômulo Cerqueira
Sent: Thursday, September 27, 2018 2:37 PM
To: osg-users@lists.openscenegraph.org
Subject: EXTERNAL: Re: [osg-users] Read Image from RTT

Hi Martin,

I never faced with this problem. Do you have some tip to solve it?
... 

Thank you!

Cheers,
Rômulo

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





___
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] Read Image from RTT

2018-09-27 Thread Rômulo Cerqueira
Hi Martin,

I never faced with this problem. Do you have some tip to solve it?
... 

Thank you!

Cheers,
Rômulo

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





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


Re: [osg-users] EXTERNAL: Read Image from RTT

2018-09-27 Thread Rowley, Marlin R
What if your gfxc returns NULL?  You assume that gfxc->getTraits() should 
always have a valid reference pointer.


Marlin Rowley
Software Engineer, Staff

Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com

-Original Message-
From: osg-users  On Behalf Of 
Rômulo Cerqueira
Sent: Thursday, September 27, 2018 2:07 PM
To: osg-users@lists.openscenegraph.org
Subject: EXTERNAL: [osg-users] Read Image from RTT

Hi,

I have tried to read image from RTT (where the image is "not attached", but 
available on buffer) using a osg::Camera::DrawCallback, the compilation is 
working, however the executable brings me a segmentation fault during image 
rendering. How can I solve this?



Code:
WindowCaptureScreen::WindowCaptureScreen(osg::ref_ptr 
gfxc, osg::Texture2D* tex) {
_mutex = new OpenThreads::Mutex();
_condition = new OpenThreads::Condition();
_image = new osg::Image();

// checks the GraficContext from the camera viewer
if (gfxc->getTraits()) {
_tex = tex;
int width = gfxc->getTraits()->width;
int height = gfxc->getTraits()->height;
_image->allocateImage(width, height, 1, GL_RGBA, GL_FLOAT);
}
}

WindowCaptureScreen::~WindowCaptureScreen() {
delete (_condition);
delete (_mutex);
}

osg::ref_ptr WindowCaptureScreen::captureImage() {
//wait to finish the capture image in call back
_condition->wait(_mutex);

return _image;
}

void WindowCaptureScreen::operator ()(osg::RenderInfo& renderInfo) const {
osg::ref_ptr gfxc = 
renderInfo.getState()->getGraphicsContext();

if (gfxc->getTraits()) {
_mutex->lock();

// read the color buffer as 32-bit floating point
renderInfo.getState()->applyTextureAttribute(0, _tex);

// THE PROGRAM CRASHES HERE
_image->readImageFromCurrentTexture(renderInfo.getContextID(), true, 
GL_FLOAT);

// grants the access to image
_condition->signal();
_mutex->unlock();
}
}




Output from GDB:


Code:
#0  0xff88 in ?? ()
#1  0x7fffef1ee39d in normal_depth_map::WindowCaptureScreen::operator() 
(this=0x7fffb53ee7a0, renderInfo=...)
at 
/home/romulo/dev/sonarsim/simulation/normal_depth_map/src/ImageViewerCaptureTool.cpp:158
#2  0x7fffebb43b10 in osgUtil::RenderStage::draw(osg::RenderInfo&, 
osgUtil::RenderLeaf*&) ()
   from target:/usr/lib/x86_64-linux-gnu/libosgUtil.so.100
#3  0x7fffebb4bdb7 in osgUtil::SceneView::draw() () from 
target:/usr/lib/x86_64-linux-gnu/libosgUtil.so.100
#4  0x7fffec31c03f in osgViewer::Renderer::draw() () from 
target:/usr/lib/x86_64-linux-gnu/libosgViewer.so.100
#5  0x7fffef557d49 in osg::GraphicsContext::runOperations() ()
   from target:/usr/lib/x86_64-linux-gnu/libosg.so.100
#6  0x7fffef5a7bbf in osg::OperationThread::run() () from 
target:/usr/lib/x86_64-linux-gnu/libosg.so.100
#7  0x7fffef5596f8 in osg::GraphicsThread::run() () from 
target:/usr/lib/x86_64-linux-gnu/libosg.so.100
#8  0x7fffecbd06c8 in OpenThreads::ThreadPrivateActions::StartThread(void*) 
()
   from target:/usr/lib/x86_64-linux-gnu/libOpenThreads.so.20
#9  0x760246ba in start_thread (arg=0x7fffa7efe700) at 
pthread_create.c:333
#10 0x7130f41d in clone () at 
../sysdeps/unix/sysv/linux/x86_64/clone.S:109




Thanks in advance,

Cheers,
Rômulo

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





___
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] Read Image from RTT

2018-09-27 Thread Rômulo Cerqueira
Hi,

I have tried to read image from RTT (where the image is "not attached", but 
available on buffer) using a osg::Camera::DrawCallback, the compilation is 
working, however the executable brings me a segmentation fault during image 
rendering. How can I solve this?



Code:
WindowCaptureScreen::WindowCaptureScreen(osg::ref_ptr 
gfxc, osg::Texture2D* tex) {
_mutex = new OpenThreads::Mutex();
_condition = new OpenThreads::Condition();
_image = new osg::Image();

// checks the GraficContext from the camera viewer
if (gfxc->getTraits()) {
_tex = tex;
int width = gfxc->getTraits()->width;
int height = gfxc->getTraits()->height;
_image->allocateImage(width, height, 1, GL_RGBA, GL_FLOAT);
}
}

WindowCaptureScreen::~WindowCaptureScreen() {
delete (_condition);
delete (_mutex);
}

osg::ref_ptr WindowCaptureScreen::captureImage() {
//wait to finish the capture image in call back
_condition->wait(_mutex);

return _image;
}

void WindowCaptureScreen::operator ()(osg::RenderInfo& renderInfo) const {
osg::ref_ptr gfxc = 
renderInfo.getState()->getGraphicsContext();

if (gfxc->getTraits()) {
_mutex->lock();

// read the color buffer as 32-bit floating point
renderInfo.getState()->applyTextureAttribute(0, _tex);

// THE PROGRAM CRASHES HERE
_image->readImageFromCurrentTexture(renderInfo.getContextID(), true, 
GL_FLOAT);

// grants the access to image
_condition->signal();
_mutex->unlock();
}
}




Output from GDB:


Code:
#0  0xff88 in ?? ()
#1  0x7fffef1ee39d in normal_depth_map::WindowCaptureScreen::operator() 
(this=0x7fffb53ee7a0, renderInfo=...)
at 
/home/romulo/dev/sonarsim/simulation/normal_depth_map/src/ImageViewerCaptureTool.cpp:158
#2  0x7fffebb43b10 in osgUtil::RenderStage::draw(osg::RenderInfo&, 
osgUtil::RenderLeaf*&) ()
   from target:/usr/lib/x86_64-linux-gnu/libosgUtil.so.100
#3  0x7fffebb4bdb7 in osgUtil::SceneView::draw() () from 
target:/usr/lib/x86_64-linux-gnu/libosgUtil.so.100
#4  0x7fffec31c03f in osgViewer::Renderer::draw() () from 
target:/usr/lib/x86_64-linux-gnu/libosgViewer.so.100
#5  0x7fffef557d49 in osg::GraphicsContext::runOperations() ()
   from target:/usr/lib/x86_64-linux-gnu/libosg.so.100
#6  0x7fffef5a7bbf in osg::OperationThread::run() () from 
target:/usr/lib/x86_64-linux-gnu/libosg.so.100
#7  0x7fffef5596f8 in osg::GraphicsThread::run() () from 
target:/usr/lib/x86_64-linux-gnu/libosg.so.100
#8  0x7fffecbd06c8 in OpenThreads::ThreadPrivateActions::StartThread(void*) 
()
   from target:/usr/lib/x86_64-linux-gnu/libOpenThreads.so.20
#9  0x760246ba in start_thread (arg=0x7fffa7efe700) at 
pthread_create.c:333
#10 0x7130f41d in clone () at 
../sysdeps/unix/sysv/linux/x86_64/clone.S:109




Thanks in advance,

Cheers,
Rômulo

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





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


[osg-users] Value of a variable in shaders?

2018-09-27 Thread Rowley, Marlin R
All,

Is there a way to examine variable values in shader code? I can't figure out 
this problem that we are having unless I can see the values in the shaders.

Any help would be appreciated


Marlin Rowley
Software Engineer, Staff
[cid:image002.jpg@01D39374.DEC5A2E0]
Missiles and Fire Control
972-603-1931 (office)
214-926-0622 (mobile)
marlin.r.row...@lmco.com

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


Re: [osg-users] issues compiling 3.0.1

2018-09-27 Thread Robert Osfield
Hi Lonni,

Laurens suggested fix is what I would have suggested too so I'd
recommend you just apply these locally.

For updating to the latest version, given that you are jumping from
3.01 to 3.6.x would be a big jump.  Both are still part of 3.x series
so broadly similar w.r.t public API, so for the most part I would
expect a recompile to be sufficient.  It's still a long period though
so there are lots changes to the interface, implementations, as
additional features or features refactored.

If you do the big jump and just find a few problems then just let us
know what issues you have and we may be able to point you in the right
direction to resolve them.   If the big jump introduces too many
issues then perhaps jumping to 3.2.x first, get things working, then
jump to 3.4.x then finally to 3.6.x might be easier.  Or if you are
lucky then just jumping to 3.4.x would be an easy enough step.

As a general note, few users now use 3.0.x so there hasn't been any
activity within the OSG community to support it, for the last couple
of years the main focus has been on 3.4.x and 3.6.x.  Build and bug
fixes have all focused on there two stable release series.  I'm pretty
confident that 3.6.3 is the best release we've made so once you've
made the leap and got things working there it should be a much more
stable base - and any issues found by the community will be wrapped up
and pushed out as subsequent minor point releases, so you'll be able
to benefit from these too.

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


Re: [osg-users] issues compiling 3.0.1

2018-09-27 Thread Voerman, L.
Hi Lonni,
Both were fixed in 2012 by replacing false with NULL.
Regards, Laurens.

Revision: 5743d30dc1614ce4ee809cbc96d1b09c3778c4c2
Author: Robert Osfield 
Date: 2/9/2012 4:54:13 PM
Message:
>From Olaf Flebbe, "there are two ocurrences where pointer to bool is mixed
with bool. Fixes warnings on MacOSX with llvm.

diff --git a/src/osg/State.cpp b/src/osg/State.cpp
index 0b88d63..2137bbd 100644
--- a/src/osg/State.cpp
+++ b/src/osg/State.cpp
@@ -109,7 +109,7 @@ State::State():
}
}

-_abortRenderingPtr = false;
+_abortRenderingPtr = NULL;

_checkGLErrors = ONCE_PER_FRAME;

@@ -689,7 +689,7 @@ bool State::getLastAppliedTextureMode(unsigned int
unit,Stat

 const StateAttribute* State::getLastAppliedTextureAttribute(unsigned int
unit,S
 {
-if (unit>=_textureAttributeMapList.size()) return false;
+if (unit>=_textureAttributeMapList.size()) return NULL;
return
getLastAppliedAttribute(_textureAttributeMapList[unit],type,member);
 }

"

Modified: src/osg/State.cpp


On Wed, Sep 26, 2018 at 10:59 PM  wrote:

> Hello, I am trying to upgrade some image generators and found that we can
> no longer compile our code.  In fact I cannot compile OSG 3.0.1 anymore.
> Here is the error I getting:
>
>
>
> /data/oldproject/OpenSceneGraph/src/osg/State.cpp: In constructor ‘
> osg::State::State()’:
> /data/oldproject/OpenSceneGraph/src/osg/State.cpp:112:26: error: cannot
> convert ‘bool’ to ‘bool*’ in assignment
> _abortRenderingPtr = false;
>  ^
> /data/oldproject/OpenSceneGraph/src/osg/State.cpp: In member function ‘const
> osg::StateAttribute* osg::State::getLastAppliedTextureAttribute(unsigned
> int, osg::StateAttribute::Type, unsigned int) const’:
> /data/oldproject/OpenSceneGraph/src/osg/State.cpp:692:55: error: cannot
> convert ‘bool’ to ‘const osg::StateAttribute*’ in return
> if (unit>=_textureAttributeMapList.size()) return false;
>   ^
> src/osg/CMakeFiles/osg.dir/build.make:2702: recipe for target
> 'src/osg/CMakeFiles/osg.dir/State.o' failed
> make[2]: *** [src/osg/CMakeFiles/osg.dir/State.o] Error 1
> CMakeFiles/Makefile2:300: recipe for target
> 'src/osg/CMakeFiles/osg.dir/all' failed
> make[1]: *** [src/osg/CMakeFiles/osg.dir/all] Error 2
> Makefile:129: recipe for target 'all' failed
> make: *** [all] Error 2
>
>
> We made an effort to upgrade our software to use the latest and greatest
> OSG but failed because of some low level code issues which we just don't
> understand.  We plan to do a tech refresh.  This is just a band aid to keep
> things usable.
>
> ___
> 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