<div dir="ltr"><div>Hello,</div><div><br></div><div>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? <br></div><div><br></div><div>There must be a way to detect the frame buffer size in OSG, but I cannot find it.<br></div><div><br></div><div>The particular issue occurs with the FLTK sample program when compiled on my macbook.<br></div><div><br></div><div>//https://github.com/openscenegraph/OpenSceneGraph/blob/master/examples/osgviewerFLTK/osgviewerFLTK.cpp</div><div><br></div><div>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?</div><div><br></div><div>On windows, I understand this issue could be fixed with a call to</div><div><br></div><div>/// ::SetProcessDPIAware(); //.. .alternately: SetProcessDpiAwareness()</div><div><br></div><div>but there seems to be no equivalent on for OSX.</div><div><br></div><div>I was unsuccessful accessing the function glfwGetFramebufferSize defined in <GLFW/glfw3.h> <br></div><div><br></div><div>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. <br></div><div><br></div><div> AdapterWidget(x,y,w,h,label),xpixscale(1.0),ypixscale(1.0)<br> {<br> getCamera()->setViewport(new osg::Viewport(0,0,xpixscale*w,ypixscale*h));<br> getCamera()->setProjectionMatrixAsPerspective(30.0f, static_cast<double>(w)/static_cast<double>(h), 1.0f, 10000.0f);<br> getCamera()->setGraphicsContext(getGraphicsWindow());<br> getCamera()->setDrawBuffer(GL_BACK);<br> getCamera()->setReadBuffer(GL_BACK);<br> <br> setThreadingModel(osgViewer::Viewer::SingleThreaded);<br> // unsigned int swidth, sheight;<br> // osgViewer::GraphicsWindow * _gw = getGraphicsWindow();<br> // osg::GraphicsContext * gc = (osg::GraphicsContext*) _gw;<br> // osg::GraphicsContext::WindowingSystemInterface * wsi = gc->getWindowingSystemInterface();<br> // //yields wsi->Name == "Cocoa" but no other useful information<br> // osg::DisplaySettings *ds = gc->getWindowingSystemInterface()->getDisplaySettings(); // This is NULL<br> // sheight = ds->getScreenHeight();<br> // swidth = ds->getScreenWidth();<br> // std::cout << sheight << " " << swidth << std::endl;<br> }</div><div><br></div><div>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?</div><div><br></div><div>Thanks<br></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups "OpenSceneGraph Users" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="mailto:osg-users+unsubscribe@googlegroups.com">osg-users+unsubscribe@googlegroups.com</a>.<br />
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/osg-users/b92b3183-f1f0-4238-901e-37e73da3978e%40googlegroups.com?utm_medium=email&utm_source=footer">https://groups.google.com/d/msgid/osg-users/b92b3183-f1f0-4238-901e-37e73da3978e%40googlegroups.com</a>.<br />