Hello, The viewport dpi is different from the window dpi on OSX. Is there a way to fix the viewport dimensions, preferably by autodetecting the size of the frame buffer, so that the viewport size matches the window size?
There must be a way to detect the frame buffer size in OSG, but I cannot find it. The particular issue occurs with the FLTK sample program when compiled on my macbook. //https://github.com/openscenegraph/OpenSceneGraph/blob/master/examples/osgviewerFLTK/osgviewerFLTK.cpp On OSX, the viewport fills the bottom left quarter of the window. I have read the scale factor to apply to the viewport is 2x the window size, but the resulting dimensions of the rescaled viewport are not exactly right. is there a way to access the framebuffer to get its dimensions? On windows, I understand this issue could be fixed with a call to /// ::SetProcessDPIAware(); //.. .alternately: SetProcessDpiAwareness() but there seems to be no equivalent on for OSX. I was unsuccessful accessing the function glfwGetFramebufferSize defined in <GLFW/glfw3.h> I have also tried to modify the sample code AdapterWidget() with the following commented lines to access the frame buffer size from OSG, with no luck. AdapterWidget(x,y,w,h,label),xpixscale(1.0),ypixscale(1.0) { getCamera()->setViewport(new osg::Viewport(0,0,xpixscale*w,ypixscale*h)); getCamera()->setProjectionMatrixAsPerspective(30.0f, static_cast<double>(w)/static_cast<double>(h), 1.0f, 10000.0f); getCamera()->setGraphicsContext(getGraphicsWindow()); getCamera()->setDrawBuffer(GL_BACK); getCamera()->setReadBuffer(GL_BACK); setThreadingModel(osgViewer::Viewer::SingleThreaded); // unsigned int swidth, sheight; // osgViewer::GraphicsWindow * _gw = getGraphicsWindow(); // osg::GraphicsContext * gc = (osg::GraphicsContext*) _gw; // osg::GraphicsContext::WindowingSystemInterface * wsi = gc->getWindowingSystemInterface(); // //yields wsi->Name == "Cocoa" but no other useful information // osg::DisplaySettings *ds = gc->getWindowingSystemInterface()->getDisplaySettings(); // This is NULL // sheight = ds->getScreenHeight(); // swidth = ds->getScreenWidth(); // std::cout << sheight << " " << swidth << std::endl; } There must be a solution to detecting the frame buffer size in OSG so the viewport size can be scaled to the window size. but I cannot find it. Does anyone have a solution? Thanks -- You received this message because you are subscribed to the Google Groups "OpenSceneGraph Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/osg-users/b92b3183-f1f0-4238-901e-37e73da3978e%40googlegroups.com.
