Open CASCADE 7.4.0 brings new handy class AIS_ViewController.
3D Viewer needs handling mouse input to bring interactivity to it. AIS_ViewController class takes responsibility for mapping user input events (mouse, keyboard, etc.) onto 3D viewer camera manipulations (rotation, panning, zooming) as well as highlighting objects in scene. Basically, it provides a more solid, cross-platform interface to V3d_View and AIS_InteractiveContext methods. AIS_ViewCube is another new class in OCCT 7.4.0 displaying an interactive cube for selecting 3D viewer camera direction.
As existing OCCT users might be curious what AIS_ViewController is, I have decided writing a small memo in Questions & Answers form.
sView user on Android device just sent me a link to online stereoscopic 3D video with yuv420p10 pixel format… and it is not an anime. The user complained about green screen in the player instead of a video. So far I haven’t seen much videos with more than 8-bit per channel in a wild, and appearance of such files in online services surprised me.
FFmpeg decodes such videos into pixel formats like AV_PIX_FMT_YUV420P10LE. This pixel format has 10-bit per-channel payload, but actually aligned into 16-bit per-channel planes. sView uploads such pixel formats into GL_ALPHA16 textures, which has been implemented a long time ago. After some investigation, I figured out that there is no OpenGL ES implementation supporting such texture format, and the only direct counterpart is GL_R16_EXT (normalized 16-bit red channel only format, same as GL_R16 on desktop), which is not yet in any core OpenGL ES specs, and requires extension GL_EXT_texture_norm16.
By the way, all this “deprecation thing” applied to useful texture formats like GL_APHA8, replaced by GL_R8 for no profit within OpenGL 3+ on desktop, always confused be. Applications supporting wide range of OpenGL drivers (including OpenGL 2.1) has to be messed up with different code per OpenGL version for exactly the same thing! As texture swizzling came later (and also messed-up API), fallback requires dummy GLSL code modifications fetching .r or .a of texture sample color.
Apparently, so far just two vendors support GL_EXT_texture_norm16 extension – Qualcomm Adreno and NVIDIA Tegra, which is quite predictable considering links to desktop graphics in their past. Testing on Adreno device has shown good playback performance of given video sample.
Unfortunately, devices with Mali graphics do not support this extension, leading to bad performance due to software conversion via SWScaler. Possible solution would be uploading planes into GL_R16UI textures (which is included into OpenGL ES 3.0 specs, but integer formats do not support texture filtering) and either implement texture filtering via GLSL program or convert it further into GL_R32F format (the latter one seems to be implemented by some internet browsers).
Mesh displayed in OCCT 3D Viewer might come from different sources – imported from external file (glTF, JT, STL, PLY, OBJ), computed for analytical BRep geometry by BRepMesh and ExpressMesh algorithms or generated directly by application code.
Draw Harness test case for Mesh Edges.
The mesh is usually displayed shaded, but this presentation is not suitable for analysis of mesh structure. In many cases, application developer needs other mesh presentations to locate issues (too many details, not enough details, local deviations, etc.) and make corrections based on analysis results (adjust mesh generation or export parameters).
In this case, mesh edges presentation becomes very helpful. Continue reading
Using external libraries in a project as well as writing your own library reveal API/ABI compatibility issues. It is difficult preserving a public API of an intensively developed library, and almost impossible managing ABI compatibility.
In this article I’m just sharing my thoughts about maintenance burden to keep sView source code compatible with various Linux (Ubuntu) releases depending on FFmpeg version.
One more handful tool without user interface – CheckDLL. This one I’ve developed a long time ago (since ‘2010), but just recently have decided making it available to everybody:
It is a common problem for developer (and less common for user) that application doesn’t show up due to some libraries missing. There might be a plenty of reasons for that – mess up in environment variables (and/or batch scripts), mess up in system (some dump application decided installing a version-less DLL in System32), some libraries haven’t been copied by delivery script, mess up with 32-bit and 64-bit DLLs, forgetting dependency from C/C++ runtime libraries, etc.
The most common way for developer to check which dependencies library/application has on Windows platform is using Dependency Walker tool. This is a powerful tool, but in most cases it is over-complicated for simple use cases. In practice, I’m prefer using a Fileinfo plugin for Total Commander instead.
Still, when I need to know if there are some broken DLLs in a folder, I’m using CheckDLL. Just put this tool into your folder and launch from explorer to see that every library can be loaded. Alternatively, the tool can be also started from command-line with a path to the folder.
Every developer of 3D applications have to know which graphics driver is currently installed on system. And not just developer, this information might be pretty helpful even for normal user for troubleshooting issues with 3D applications. Knowing that graphics driver is installed in system sometimes doesn’t indicate that they are fully functional – in particular, on Windows platform Direct3D application might work well, while OpenGL applications don’t. While there is a plenty diagnostic tools available for that purpose, command-line tools might be more handful in many cases.
glxinfo is pretty small but helpful command-line tool on Linux, well-known by both professional and common users. It’s purpose is very simple – to print diagnostic information about OpenGL graphic driver installed on the system. OpenGL version and graphics driver vendor are most useful from the output, although for developer every printed line could be helpful (like the list of available OpenGL extensions).
Installing glxinfo is pretty simple on Linux (just “sudo apt-get install glxinfo” on any Debian-based distributive), but Windows lacks such a helpful tool at hand. Curious users, however, should be aware of wglinfo – an analog of glxinfo for Windows which can be downloaded from some sites. Unfortunately, the output of original tool lacks some important details like a list of WGL extensions and lacks updates for a very long time.
After struggling once again with this problem, I’ve decided developing and publishing a slightly “upgraded” version of wglinfo on GitHub, which now outputs more details about OpenGL:
In addition to OpenGL provided by system (WGL), it also prints information using EGL (libEGL.dll), if it is available.
CAD Assistant 0.9 released on 3rd of April, ‘2017 is a big step from previous release 0.8 with many new features and improvements in changelog:
- Import of JT models (only mesh, no LODs).
- Option to import multiple models into a single document.
- Assembly structure is now displayed also for mesh-only files.
- Improved performance while displaying big assemblies.
- Improved glTF mesh format support.
- Support of polygons with more than 4 nodes within mesh import.
- Option to control nodes merging for STL mesh import.
- Option to rotate around a picked point.
- Option to use shaded mode for highlighting a selected object.
CAD Assistant is based on Open CASCADE Technology and demonstrates two of its strongest parts – data exchange (import/export of files in open standards STEP and IGES) and efficient multi-platform visualization based on OpenGL / OpenGL ES.
- PLY mesh with Nodal+Elemental properties
and interactive color scale in CAD Assistant (iPhone).
Go to the article – CAD Assistant 0.9