TypeError: Failed to execute 'texImage2D' on ... - Stack Overflow

文章推薦指數: 80 %
投票人數:10人

Failed to execute 'texImage2D' on 'WebGL2RenderingContext ... Home Public Questions Tags Users Companies Collectives ExploreCollectives Teams StackOverflowforTeams –Startcollaboratingandsharingorganizationalknowledge. CreateafreeTeam WhyTeams? Teams CreatefreeTeam Collectives™onStackOverflow Findcentralized,trustedcontentandcollaboratearoundthetechnologiesyouusemost. LearnmoreaboutCollectives Teams Q&Aforwork Connectandshareknowledgewithinasinglelocationthatisstructuredandeasytosearch. LearnmoreaboutTeams TypeError:Failedtoexecute'texImage2D'on'WebGLRenderingContext':Overloadresolutionfailed AskQuestion Asked 1yearago Modified 1yearago Viewed 2ktimes 1 I'mtryingtocreatea3dcustomizerusingfabricjsascanvastextureforthreejsmodel.Iloadobjfilelikethis functionloadObj(){ canvasTexture.anisotropy=renderer.capabilities.getMaxAnisotropy(); textureMaterial=newTHREE.MeshPhongMaterial({map:canvasTexture}); texture.needsUpdate=true; varloader=newTHREE.OBJLoader2(manager); loader.load('assets/men/cat1/model1.obj',function(data){ if(object!=null){ scene.remove(object); } object=null; object=data.detail.loaderRootNode; materials=[]; object.traverse(function(child){ if(child.isMesh){ child.material.map=textureMaterial; }; }); console.log(object.children[0].material) object.children[0].material=textureMaterial; render(); varscale=height/5; object.scale.set(scale,scale,scale); object.position.set(0,-scale*1.25,0); object.rotation.set(0,Math.PI/2,0); object.receiveShadow=true; object.castShadow=true; scene.add(object); }); } andhere'smyfabricjs varcanvas=newfabric.Canvas("canvas"); canvas.backgroundColor="#FFBE9F"; vartext=newfabric.IText('Three.js\n+\nFaBric.js',{ fontSize:100, textAlign:'center', fontWeight:'bold', left:500, top:500, originX:'center', originY:'center', selectable:true//makethisobjectselectable }); fabric.loadSVGFromURL('assets/men/cat1/prod1/pattern.svg',function(objects,options){ varsvgData=fabric.util.groupSVGElements(objects,{selectable:false,crossOrigin:'anonymous'}); svgData.top=420; svgData.left=70; canvas.add(svgData); canvas.sendToBack(svgData); }); canvas.add(text); vartexture=newTHREE.Texture(document.getElementById("canvas")); fabric.Image.fromURL('assets/men/cat1/texture.png',function(myImg){ varimg1=myImg.set({left:0,top:0,selectable:false,crossOrigin:'anonymous'}); canvas.add(img1); canvas.sendToBack(img1); }); andmy3dmodelisallblacklikethis anyonehaveanyideahowtofixthis?iwanttowrapmyfabricjscanvastomy3dmodel javascriptthree.jsfabricjs Share Improvethisquestion Follow askedSep21,2021at8:25 naovalluthfinaovalluthfi 65366silverbadges1818bronzebadges 1 Doesthisansweryourquestion?howtoloadfabricjsastextureforobjusingthreejs – ZachSaucier Jul27at21:38 Addacomment  |  1Answer 1 Sortedby: Resettodefault Highestscore(default) Trending(recentvotescountmore) Datemodified(newestfirst) Datecreated(oldestfirst) 0 Afterifindseveralsolution,ifoundthatthisproblemishasthesamesolutiontothisposthowtoloadfabricjsastextureforobjusingthreejs theproblemwasiusefabricjscanvasasargumentforTHREE.Texturewhichonlysupportimage,soichangeittocanvastaginstead,readaboveposthopeithelpssomeone. Share Improvethisanswer Follow answeredSep22,2021at1:24 naovalluthfinaovalluthfi 65366silverbadges1818bronzebadges Addacomment  |  YourAnswer ThanksforcontributingananswertoStackOverflow!Pleasebesuretoanswerthequestion.Providedetailsandshareyourresearch!Butavoid…Askingforhelp,clarification,orrespondingtootheranswers.Makingstatementsbasedonopinion;backthemupwithreferencesorpersonalexperience.Tolearnmore,seeourtipsonwritinggreatanswers. Draftsaved Draftdiscarded Signuporlogin SignupusingGoogle SignupusingFacebook SignupusingEmailandPassword Submit Postasaguest Name Email Required,butnevershown PostYourAnswer Discard Byclicking“PostYourAnswer”,youagreetoourtermsofservice,privacypolicyandcookiepolicy Nottheansweryou'relookingfor?Browseotherquestionstaggedjavascriptthree.jsfabricjsoraskyourownquestion. TheOverflowBlog MeetSaves:thetooltohelpyouorganizeyourfavoritecontentonStack... MeettheAIhelpingyouchoosewhattowatchnext FeaturedonMeta BookmarkshaveevolvedintoSaves(temporarilydisabled) Recentcolorcontrastchangesandaccessibilityupdates Revieweroverboard!Orarequesttoimprovetheonboardingguidancefornew... CollectivesUpdate:RecognizedMembers,Articles,andGitLab The[placement]tagisbeingburninated ShouldIexplainotherpeople'scode-onlyanswers? Linked 1 howtoloadfabricjsastextureforobjusingthreejs Related 1618 Howtomeasuretimetakenbyafunctiontoexecute 983 HowtomakeJavaScriptexecuteafterpageload? 10 AnimatingcanvasbillboardinThree.js 5 OddartifactsandEmptytextureinextrudedshapeinthree.js 5 Three.jsUncaughtSecurityError:Failedtoexecute'texImage2D'on'WebGLRenderingContext': 2 ThreeJSDOMException:Failedtoexecute'texImage2D'on'WebGLRenderingContext' HotNetworkQuestions Istheexpression"holdthefort"usedincorrectlyhere? ComparingdifferentGAMsusingAICwhenthemodelswerefittedusing"method=REML"inmgcv IfEarth'satmosphereistechnicallyvioletbutoureyescan'tseeit,isthereapossiblevariablethatcanletusperceivethat? Howshouldatravellerreportthathis/her(reserved)accommodationisrefusedbytheproprietoronbooking.com? Non-drivesidecrankarmrubbingchainstay,canIfileitdown? Howtostartafunctionautomaticallyaftercertainperiodoftime? DoesthesunorbitGreatA'TuinortheDiscworld? HowdidpeoplegetappsontheircomputerbeforetheInternet? Howtosurvivelevel1asawizard? Whatisthenameofthisview,thatconsciousnessbuildsreality? Whydoesthe"TanksforUkraine"discussionfocusontheLeopard2? GenerateParitybits What'sthevaluetoberealizedina'teamworkagreement'? Apostapocalypticstoryaboutafatheranddaughterwhosurviveanalienattackthatwipesouthumanity Oregonpropertydisclosurelaw:buyerdiscoverscrackingfoundationthatsellerdidnotdisclose-20monthsafterclosing Grandpa'speculiarTV RepeatValuesInArray Expectednumberofrandomcomparisonsneededtosortalist HowtomakeaRoll20macrothatrollsAdvantageandaddsamodifier? Whywouldn'ttheanglemarkingsonanattitudeindicatormatchthehorizonline? WhoweretheattackersofGlensFalls?(TheLastoftheMohicans) Why,sinceEarthisinfreefalltowardsSun,aretidesaffectedbySun'sgravity?Whyaren'ttheoceans"weightless"likeastronauts? HowdoesThespian'sStageworkwithUrza'sSaga? HowwasthefirstreleaseofJava(JDK1.0)used? morehotquestions Questionfeed SubscribetoRSS Questionfeed TosubscribetothisRSSfeed,copyandpastethisURLintoyourRSSreader. lang-js Yourprivacy Byclicking“Acceptallcookies”,youagreeStackExchangecanstorecookiesonyourdeviceanddiscloseinformationinaccordancewithourCookiePolicy. Acceptallcookies Customizesettings  



請為這篇文章評分?