Re: [osg-users] Visualization problem on iMac 5K

2016-03-10 Thread Stefan Buschmann

Hi,

that's a typical error when working with high-resolution (retina) 
displays. The issue here is that on the high-resolution devices, the UI 
operates with a virtual pixel size that is smaller than the real number 
of pixels on the device. For example, you get coordinates from 0 to 2048 
while the real device resolution if 4096 pixels. This factor has to be 
taken into account when mapping from window coordinates to OpenGL, e.g., 
when calling glViewport.


How you can get this factor depends on the GUI library you are using. In 
Qt, you can query it with QWindow::devicePixelRatio():

  http://doc.qt.io/qt-5/qwindow.html#devicePixelRatio

So, there should be something like
  glViewport(0, 0, window->width() * window->devicePixelRatio(), 
window->height() * window->devicePixelRatio()).


Also keep in mind that you have to do the same e.g. for mouse coordinates.

I think osgQt already handles this correctly, so you shouldn't have to 
worry about this if you use the classes provided by osgQt ...


Regards,

Stefan


On 10.03.2016 17:25, Ale Maro wrote:

Hi,

I recently compiled my application on OS X (it is a Qt based application).
Everything is working fine on Mac Mini (with Intel Iris graphics card) and 
the same code on Windows also works fine.
When I tried on an iMac 5K (ATI Radeon R9 M290) I had a visualization problem.
The view is shown in the bottom left quadrant of the windows (instead of 
covering the entire window) and the other quadrants are not refreshed.

I tried with any resolution and the problem remains the same.
Any ideas?

Thank you for any help.

Best regards,
Ale

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





___
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] Render into a QQuickFramebufferObject (osg / osgEarth)

2015-03-24 Thread Stefan Buschmann

Hi,

you could have a look at the OSG-integration into our rendering 
framework gloperate (github/hpicgs/gloperate), where I have implemented 
a very similar setup. The OpenGL context is managed from the outside, 
and OSG rendering is set up with setUpViewerAsEmbeddedInWindow, which 
means that the OSG does not really know about the context and you have 
to make sure the context is made current before rendering.


I also had the problem that it worked with OSG but not osgEarth, which I 
tracked down to the following problem: On the first frame, osgEarth 
initializes itself and queries its capabilities (see 
osgEarth/Capabilities.cpp). To do that, it initializes a temporary 
OpenGL context, queries OpenGL version and available functions, and then 
releases the context. With a typical OSG setup, we have an OSG context 
object that will be made current before rendering, so this makes no 
problems. But when using setUpViewerAsEmbeddedInWindow, the OSG has no 
way to make your context current, because it does not know about it. So, 
after osgEarth is initialized, you have lost your OpenGL context and 
have to make it current again before rendering.


Hope this helps,

Stefan



On 24/03/15 15:49, Sascha Voth wrote:

Hi,

I'm trying to render a scene node in a QtQuickItem. For this I used the Qt example 
Scene Graph - Rendering FBOs as a base template:

qtquick-scenegraph-textureinsgnode-fboinsgrenderer-cpp @ qt.io

Additionally I found a Gists which does nearly the same thing I'm trying to 
achieve:

gist:9bf4cec0aee18fc6e27b

On construction I create an EmbeddedWindow and a Viewer, and setup my scene. 
Afterwards the createFramebufferObject is used to allocate the FBO and resize 
the EmbeddedViewer and the Viewport. Rendering is triggered with a frame() call 
inside the render function and the osg::Viewer is set up to run SingleThreaded.

As long as I use/add a simple osg::Node to the scene, e.g. cow.osg, everything 
seems to work fine. As soon I start to change the CameraManipulator to 
osgEarth::Util::EarthManipulator and use a osgearth::MapNode instead, the first 
drawn frame is black, and changes only on re-sizing and recreating the FBO, but 
only once. Afterwards, the render function is called, but frame() seems to not 
render anything anymore.

I suppose something gets messed up with the OpenGLContext or osgEarth does not 
work SingleThreaded, but I'm currently not able to understand the problem as a 
whole. I even tried to create a new shared context like rickyviking/qmlosg at 
github did, but could not get it to render a propre scene.

Any help would be appreciated!

Thank you!

Cheers,
Sascha

p.s.: I've tried different other approaches in advance, where many of them seem 
to be outdated or lacking simple re-sizing functionality. My current 
implementation uses a QQuickItem which has a re-implemented 
QSGSimpleTextureNode which shares an FBO with an osg::Camera. But i cannot 
manage to resize the fbo texture ...

p.p.s.: Sorry for not posting the links directly, but You must have 2 posts before 
you can post URL's/Links. ...

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





___
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