1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-01 17:36:21 +03:00
occt/samples/webgl/occt-webgl-viewer.js
kgv a34bddcfd6 0032315: Configuration, CMake - fix building Draw Harness plugins as static libraries
DPLUGIN() macros no more defines exported function PLUGINFACTORY when building static libraries.
DRAWEXE executable now pre-loads a set of plugins when building static libraries.
dversion - added WebAssembly info.
2021-04-23 18:46:13 +03:00

29 lines
1.1 KiB
JavaScript

var OccViewerModule =
{
print: (function() {
var anElement = document.getElementById('output');
return function(theText) { anElement.innerHTML += theText + "<br>"; };
})(),
printErr: function(theText) {
//var anElement = document.getElementById('output');
//anElement.innerHTML += theText + "<br>";
console.warn(theText);
},
canvas: (function() {
var aCanvas = document.getElementById('occViewerCanvas');
var aGlCtx = aCanvas.getContext ('webgl2', { alpha: false, depth: true, antialias: false, preserveDrawingBuffer: true } );
if (aGlCtx == null) { aGlCtx = aCanvas.getContext ('webgl', { alpha: false, depth: true, antialias: false, preserveDrawingBuffer: true } ); }
return aCanvas;
})(),
onRuntimeInitialized: function() {
//console.log(" @@ onRuntimeInitialized()" + Object.getOwnPropertyNames(OccViewerModule));
}
};
const OccViewerModuleInitialized = createOccViewerModule(OccViewerModule);
OccViewerModuleInitialized.then(function(Module) {
//OccViewerModule.setCubemapBackground ("cubemap.jpg");
OccViewerModule.openFromUrl ("ball", "samples/Ball.brep");
});