Re: [osg-users] [build] Where to obtain dependencies for Ubuntu

2016-09-12 Thread Kaku Ro
Hi,

I just boot the Ubuntu OS, open the terminal and enter the commands.
Then an error message was shown:
Unable to lock the administration directory (/var/lib/dpkg/), is another 
process using it?


Thank you!

Cheers,
rokaku

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





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


Re: [osg-users] Better data loading

2016-09-12 Thread Robert Osfield
Hi Valerian,

The PagedLOD/DatabasePager pairing is primarily written to support
paging of vis-sim databases, rather than just general loading of
databases in background threads.  These design/implementation is quite
specialized as it has to support tight performance metrics such as
avoiding frame drops, hitting a solid 60Hz, load balancing etc.

For general loading of databases you are probably best just
implementing your own scheme.  It needn't be complicated as much of
the infrastructure required already exists in the OSG - You have
osg::OperationQueue/OperationThread/Operation that can be used to run
the threads with where adding the custom load can be done just by
subclassing from osg::Operation and then adding it to the queue.  This
will then be called automatically from any OperationThread that you
attach the queue to.  All done in a thread safe way.

Merging of loading databases I'd do as part of the update phases of
the scene graph frame, but not as an update callback.  You can use the
 Viewer::addUpdateOperation(Operation*) method to add in an custom
operation that is called during the update phases of each new frame.
In this custom Operation you'd take all the subgraphs loaded by the
custom Database operations and then merge them in the appropriate
place to the main scene graph.

Have a look at the osgthreadedterrain example to see an example of
this in action.

Robert.





On 12 September 2016 at 16:13, Valerian Merkling  wrote:
> Hi,
>
> Reading this thread
> http://forum.openscenegraph.org/viewtopic.php?t=16128  scared me a little : 
> I'm using a UpdateCallback to add node into my scene graph.
>
> I've no problem with it for know but my goal was to make a clean migration 
> from openGL to OSG, so I would like to make it better.
>
> I'm looking at the DatabsaePager class to try to get what to do, but since 
> I'm working on a old app, all the threaded data loading is already done, I 
> just need to add those data to the scene graph, and I would like to know if 
> the DatabasePager can also help me in this case.
>
> And another quick question : database pager seems to work a lot with paged 
> LOD, and I'm using a lot of PagedLOD to hide/show if the camera is in a fixed 
> range (and absolutely no data loading). Is that bad ? Could it slow down 
> somethings ?
>
> Thank you!
>
> Cheers,
> Valerian
>
> --
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=68582#68582
>
>
>
>
>
> ___
> 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] Invalid Operation after applying attribute Viewport

2016-09-12 Thread Trajce Nikolov NICK
Hi Bruno,

try apitrace .. cross-platform very handy for debugging
https://github.com/apitrace/apitrace


On Mon, Sep 12, 2016 at 6:02 PM, Bruno Oliveira <
bruno.manata.olive...@gmail.com> wrote:

> Hello, I am getting the following error in an OSG viewer, with a
> osgViewer::GraphisWindowEmbedded into a QOpenGLWidget:
>
>
> detected OpenGL error 'invalid operation' after applying attribute
> Viewport 0x7f93fbe97170
>
>
>
> I get this error every time I call QOpenGLWidget::update(). This happens
> only under MacOS X (I have Qt 5.7 and OSG 3.4). This does not happen under
> Linux. I know this is insufficient information for any debug. But how can I
> get more details to debug this?
>
>
>
>
> ___
> 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


[osg-users] Invalid Operation after applying attribute Viewport

2016-09-12 Thread Bruno Oliveira
Hello, I am getting the following error in an OSG viewer, with a
osgViewer::GraphisWindowEmbedded into a QOpenGLWidget:


detected OpenGL error 'invalid operation' after applying attribute Viewport
0x7f93fbe97170



I get this error every time I call QOpenGLWidget::update(). This happens
only under MacOS X (I have Qt 5.7 and OSG 3.4). This does not happen under
Linux. I know this is insufficient information for any debug. But how can I
get more details to debug this?
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Better data loading

2016-09-12 Thread Valerian Merkling
Hi,

Reading this thread
http://forum.openscenegraph.org/viewtopic.php?t=16128  scared me a little : I'm 
using a UpdateCallback to add node into my scene graph.

I've no problem with it for know but my goal was to make a clean migration from 
openGL to OSG, so I would like to make it better.

I'm looking at the DatabsaePager class to try to get what to do, but since I'm 
working on a old app, all the threaded data loading is already done, I just 
need to add those data to the scene graph, and I would like to know if the 
DatabasePager can also help me in this case.

And another quick question : database pager seems to work a lot with paged LOD, 
and I'm using a lot of PagedLOD to hide/show if the camera is in a fixed range 
(and absolutely no data loading). Is that bad ? Could it slow down somethings ?

Thank you!

Cheers,
Valerian

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





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


Re: [osg-users] Rendering Textured Quad no longer working after moving to different View

2016-09-12 Thread Valerian Merkling
Hi,

Reading this thread
http://forum.openscenegraph.org/viewtopic.php?t=16128  scared me a little : I'm 
using a UpdateCallback to add node into my scene graph.

I've no problem with it for know but my goal was to make a clean migration from 
openGL to OSG, so I would like to make it better.

I'm looking at the DatabsaePager class to try to get what to do, but since I'm 
working on a old app, all the threaded data loading is already done, I just 
need to add those data to the scene graph, and I would like to know if the 
DatabasePager can also help me in this case.

And another quick question : database pager seems to work a lot with paged LOD, 
and I'm using a lot of PagedLOD to hide/show if the camera is in a fixed range 
(and absolutely no data loading). Is that bad ? Could it slow down somethings ?

Thank you!

Cheers,
Valerian

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





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


[osg-users] Shader, OpenGL context and Qt

2016-09-12 Thread Valerian Merkling
Hi,

I'm working on a GIS app based on Qt and OpenGL, and I'm replacing all OpenGL 
calls with OSG 3.4.0.

I can display multiples views. Each view is independant, hold in QGLWidets, got 
only one camera and its own scenegraph, and a new instances of osg::Program and 
osg::Shader (no osg objects shader between views).

Shaders works fine in the firsts views, but I soon as I close a view, shaders 
are gone for the next opened views, although I using the same source code to 
init the shaders and use a new osg::Program for it.

I was first searching in the code for shader compilation logs, and I found this 
function  : getGLProgramInfoLog(unsigned int contextId, std::string & log).

I have a few questions :

Do I have to use this function to get info about how the shader compilation was 
?

If yes, how do I get this context ID ? I always thought that Qt was managing 
OpenGL context for me, but I may be wrong ? 

Is that Context ID a possible cause of my shader problem ? 


Thank you!

Cheers,
Valerian

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





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


[osg-users] Rendering Textured Quad no longer working after moving to different View

2016-09-12 Thread Philipp Meyer
Hi,

I have a little annoying issue here and fail to understand why it happens or 
what goes wrong.

Im using a shader to compute various output Textures, some for direct display, 
others for post processing.
To be able to easily display the rendered Textures, I created a little helper 
class which derives from osg::Camera and internally used a orthographic 
projection and a Quad to render the texture to the screen. 
(Source code below) That way, I can simply add the TextureDisplay to any scene 
graph to view my rendered Texture.

Code:

/*
 * TextureView.cpp
 *
 *  Created on: Jun 8, 2016
 *  Author: ubuntu
 */

#include "TextureView.h"

#include "osgHelper.h"
#include "MDRTErrorHandling.h"

#include 

namespace MDRT {

TextureView::TextureView() {
setViewMatrix(osg::Matrix::identity());
setProjectionMatrix(osg::Matrix::ortho2D(0, 1, 0, 1));
setClearColor(osg::Vec4(1, 0, 0, 1));

//  auto mt = osgHelper::make_osgref();
//  mt->setMatrix(osg::Matrix::identity());
//  mt->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
//  addChild(mt);

auto geode = osgHelper::make_osgref();
geometry = osgHelper::make_osgref();
geode->addDrawable(geometry);
addChild(geode);

auto quadVertices = osgHelper::make_osgref();
quadVertices->push_back(osg::Vec3(0, 0, 0));
quadVertices->push_back(osg::Vec3(1, 0, 0));
quadVertices->push_back(osg::Vec3(1, 1, 0));
quadVertices->push_back(osg::Vec3(0, 1, 0));
geometry->setVertexArray(quadVertices);

auto quadPrimitiveSet = osgHelper::make_osgref(
osg::PrimitiveSet::QUADS, 0);
quadPrimitiveSet->push_back(0);
quadPrimitiveSet->push_back(1);
quadPrimitiveSet->push_back(2);
quadPrimitiveSet->push_back(3);
geometry->addPrimitiveSet(quadPrimitiveSet);

auto texCoords = osgHelper::make_osgref();
texCoords->push_back(osg::Vec2(0, 0));
texCoords->push_back(osg::Vec2(1, 0));
texCoords->push_back(osg::Vec2(1, 1));
texCoords->push_back(osg::Vec2(0, 1));
geometry->setTexCoordArray(0, texCoords, osg::Array::BIND_PER_VERTEX);

auto ss = geode->getOrCreateStateSet();

auto program = osgHelper::make_osgref();
auto vertShader = osg::Shader::readShaderFile(osg::Shader::Type::VERTEX,
"res/CustomShaders/FrameHeader.vert");
auto fragShader = 
osg::Shader::readShaderFile(osg::Shader::Type::FRAGMENT,
"res/CustomShaders/FrameHeader.frag");

if (!vertShader || !fragShader) {
throw MDRTExceptionBase("error loading textureview shaders");
}

bool ok = true;

ok = ok && program->addShader(vertShader);
ok = ok && program->addShader(fragShader);

if (!ok) {
throw MDRTExceptionBase(
"error adding textureview shaders to program 
obj");
}

ss->setAttributeAndModes(program);
ss->getOrCreateUniform("tex", osg::Uniform::Type::SAMPLER_2D_RECT, 0);

}

TextureView::~TextureView() {
// TODO Auto-generated destructor stub
}

void TextureView::setTexture(osg::Texture* tex) {
auto texRec = dynamic_cast(tex);
assert(texRec);

float texWidth = static_cast(texRec->getImage()->s());
float texHeight = static_cast(texRec->getImage()->t());

auto texCoords = osgHelper::make_osgref();
texCoords->push_back(osg::Vec2(0, 0));
texCoords->push_back(osg::Vec2(1 * texWidth, 0));
texCoords->push_back(osg::Vec2(1 * texWidth, 1 * texHeight));
texCoords->push_back(osg::Vec2(0, 1 * texHeight));
geometry->setTexCoordArray(0, texCoords, osg::Array::BIND_PER_VERTEX);
geometry->getOrCreateStateSet()->setTextureAttributeAndModes(0, tex);
geometry->dirtyDisplayList();

}

} /* namespace MDRT */




This works fine and I have used it since several months. Today, I decided that 
it would be nicer to view the Textures in a separate window, so I switched to a 
CompositeViewer and created a new View and window for the textures. After that, 
I add my TextureViews to the views main camera.



Code:
//create texture views for radar shader output
constexpr int radarCameraTextureViewWidth = 800;
constexpr int radarCameraTextureViewHeight = 
radarCameraTextureViewWidth
/ 4;
constexpr int radarTextureViewSize = 
radarCameraTextureViewHeight;

auto radarCameraTextureView = 
osgHelper::make_osgref();
radarCameraTextureView->setCameraManipulator(nullptr);

radarCameraTextureView->getCamera()->setGraphicsContext(
masterCamera->getGraphicsContext());
radarCameraTextureView->getCamera()->setViewMatrix(

[osg-users] slow speed of osgDB::writeImageFile() for monochrome PNGs?

2016-09-12 Thread Christian Buchner
Hi, I allocate and write out an 8 bit 1024x1024 pixel map like this

osg::ref_ptr img = new osg::Image;
img->allocateImage(1024, 1024, 1, GL_LUMINANCE, GL_UNSIGNED_BYTE);
/* omitted: fill the image with science (TM) */
osgDB::writeImageFile(*img, filename);

I am a bit puzzled that writing a PNG file to disk seems to take 5 seconds
in a release build, and about twice that time in debug builds.

Using Visual Studio 2015 Express Edition and the osg-3rdparty CMAKE build
process
from here https://github.com/bjornblissing/osg-3rdparty-cmake together with
libPNG 1.6.21 (lpng1621.zip)

Any idea what might cause this extremely slow writing process? It's just a
megapixel of grayscale data. I am puzzled.

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


Re: [osg-users] Trigger some function when PagedLOD finishes openening a node

2016-09-12 Thread Bruno Oliveira
Hello Robert,

thank you very much for the detailed answer. I implemented an app based on
Qt. My draw/frame events are only called when the user makes some action
(e.g. Mouse Click, Mouse Move). Is there a way I could bypass this and use
the osgViewer:::ViewerBase::ON_DEMAND option?

2016-09-10 17:36 GMT+01:00 Robert Osfield :

> Hi Bruno,
>
> You could possible use the ReadFileCllback for this purpose.  Have a
> look through the archives for discussions on the different ways that
> ReadFileCallback can be used.
>
> However, I have to add the the DatabasePager is designed to dispatch
> compile operations to the draw traversal to compile the newly loaded
> subgraphs incrementally during each frame.  A newly loaded subgraph
> isn't merged until all the GL objects in that subgraph have been
> compiled.  This means you can't just switch off doing the rendering
> loop and wait for things to load and just render one frame and expect
> everything to merge right away.  This incremental compilation exists
> to avoid frame drops.
>
> One way around this pre compilation would be to simply switch off pre
> compilation of subgraphs, this would be new subgraphs are merged in
> the frame right after it has been loaded. However, this approach
> increases the changes of a frame drop as the new data is rendered for
> the first time.
>
> There is support built into lazy update of the scene via the
> osgViewer::ViewerBase::setRunFrameScheme(...) support for the the
> osgViewer:::ViewerBase::ON_DEMAND option.  When this is set and you
> use the Viewer::run() method the viewer will automatically only call
> frame when events have happened, there are animations running or the
> database requires a new frame to be done (including for the
> incremental compilation.)   You could have a look at how this is
> implemented if you want to do something similar, or just use it
> directly.
>
> Robert.
>
> On 10 September 2016 at 09:56, Bruno Oliveira
>  wrote:
> > Hello,
> >
> >
> > I am using a PagedLOD engine, but I need to call some function I have
> every
> > time the PagedLOD finished reading a Node and it is ready for rendering.
> > This function I want to call is intended to trigger a draw/refresh
> action in
> > my viewer, but I think this could be any function at all.
> >
> >
> > How do I do that?
> >
> > Thank you
> >
> > ___
> > 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