pixi.jsとThree.jsを併用させたい
Three.jsの物をpixi.jsと一緒に表示させようとすると以下のエラーが出ます。
発生している問題・エラーメッセージ
WebGL: INVALID_OPERATION: uniformMatrix4fv: location is not from current program [.WebGL-0000021CCCB63AD0]GL ERROR :GL_INVALID_OPERATION : glDrawElements: attempt to access out of range vertices in attribute 1 WebGL: too many errors, no more errors will be reported to the console for this context.
該当のソースコード
javascript
1//pixi.js 2var width = window.innerWidth; 3var height = window.innerHeight; 4var x = width/2; 5var y = height/2; 6var stage = new PIXI.Stage(); 7var renderer = PIXI.autoDetectRenderer(width, height,{ 8 resolution: window.devicePixelRatio, 9 backgroundColor: 0x000000, 10 antialias: true 11}); 12document.getElementById("pixiview").appendChild(renderer.view); 13window.onresize = function () { 14 location.reload(); 15}; 16 17//moji 18var word = "A"; 19var style = {font:'bold 40pt Arial', fill:'white'}; 20var hitmainobj = new PIXI.Text(word, style); 21stage.addChild(hitmainobj); 22 23function animate(){ 24 requestAnimationFrame(animate); 25 box[0].rotation.x+=0.01; 26 rendererThree.render(scene, camera);//1 27 renderer.render(stage);//2 28} 29 30requestAnimationFrame(animate); 31//three.js 32var geometry=[]; 33var material=[]; 34var box=[]; 35// レンダラー 36var rendererThree = new THREE.WebGLRenderer({ 37 canvas: document.querySelector('canvas') 38}); 39rendererThree.setPixelRatio(window.devicePixelRatio); 40rendererThree.setSize(width, height); 41// シーン 42var scene = new THREE.Scene(); 43// カメラ 44var camera = new THREE.PerspectiveCamera(45, width / height); 45camera.position.set(0, 0, +1000); 46// object 47geometry[0] = new THREE.TorusGeometry( 200, 30, 20, 100, Math.PI*2); 48material[0] = new THREE.MeshBasicMaterial( { color: 0x008866, wireframe:true} ); 49box[0] = new THREE.Mesh(geometry[0], material[0]); 50scene.add(box[0]);
試したこと
1と2を入れ替えるとThree.jsで作った図形は表示されますが、Aの文字が表示されません。
補足情報(FW/ツールのバージョンなど)
pixi.js v4.8.5
Three.js r101
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。