Hi,
Is it possible to display a pdf file in an object texture in XR mode ?
Regards
Hi,
Is it possible to display a pdf file in an object texture in XR mode ?
Regards
Thanks labri for you answer.
It works fine in normal mode but it doesn’t work during a XR session.
Do you now why ?
So the question now is how to make dynamic texture work in XR, am I right?
Yes, if you think that the problem is the dynamic texture
The use of dynamic texture is different un XR mode ?
I can only make assumptions based on infromation you provided
If converting PDF to canvas works fine for you but it doesn’t work in XR I suppose there may be some problem with dynamic texture.
In this case you may try to test in XR some simple examples with dynamic textures first.
Hi labris,
Below the code that I use.
If I execute this code before entering in VR mode, it works fine and the pdf is displayed when I enter in VR mode.
But when I enter in VR mode and execute this code after it doesn’t work and my mesh disapear…
I suppose that the problen is in the function “page.render”…
Any idea ?
openPdf : function(urlPdf)
{
pdfjsLib.getDocument(urlPdf).then((pdf) => {
pdf.getPage(indexPage).then((page) => {
var pdfPlane = BABYLON.MeshBuilder.CreatePlane("ground", {width: 0.7, height: 1}, gScene);
var viewport = page.getViewport(this.pdfState.zoom);
var pdfMat = new BABYLON.BackgroundMaterial("pdfMat", gScene);
var pdfTexture = new BABYLON.DynamicTexture("dynamic texture", {width:viewport.width, height:viewport.height}, gScene);
pdfMat.diffuseTexture = pdfTexture;
var ctxPdf = pdfTexture.getContext();
var canvasPdf = pdfTexture.canvas;
pdfMat.opacityFresnel = false;
pdfPlane.material = pdfMat;
page.render({
canvasContext: ctxPdf,
viewport: viewport
}).promise.then(function(){
pdfMat.diffuseTexture.update();
});
});
}
I’m having the same problem as you
What issue are you facing? maybe create a new issue instead of reviving an old issue - it will help us help you much better.