MeVisLabResolutionIndependenceAPI
MeVisLab Resolution Independence API

High-resolution displays provide a rich visual experience, allowing users to see sharper text and more details in images than on standard-resolution displays. MeVisLab supports OpenGL rendering on high-resolution displays without scarifying readability due to small fonts, shrunken margins or thin lines.

OpenGL

OpenGL visualization modules do not support resolution independence out-of-the box, they must be adapted to it. MeVisLab extends the OpenGL render state by a pixel scale factor that facilitates this task a great deal. Just replace the standard OpenGL calls glLineWidth, glPointSize, and glLineStipple for their new counterparts ml::glLineWidthScaled, ml::glPointSizeScaled, and ml::glLineStippleScaled. Fonts will be adapted automatically. For margins and spacing use the template GLHiDPIScale. The following code snippet outlines some of the adaptations:

#include <SoViewerElement.h> // header file is part of MLInventorBinding
#include <mlGLHiDPI.h> // header file is part of MLOpenGL
...
void SoMyNode::initClass()
{
...
// Enable the SoViewerElement for the SoGLRenderAction action
SO_ENABLE(SoGLRenderAction, SoViewerElement);
}
void SoMyNode::GLRender(SoGLRenderAction *action)
{
...
// Returns the ratio between physical pixels and device-independent
// pixels for the connected viewer
double devicePixelRatio = SoViewerElement::getDevicePixelRatio(action->getState());
...
// Set width for line drawing
// Set diameter of rasterized points
// Set line stipple pattern
...
// Automatically adapt a constant or variable value by multiplying
// the value with the ratio between physical pixels and device-independent
// pixels
double margin = GLHiDPIScale(5.0);
}

OpenGL Shading Language (GLSL)

Using the SoShader framework, the following uniform can be accessed within the shader code:

uniform float oiv_DevicePixelRatio;

Modules