How to use gl.lineWidth() - Stack Overflow
文章推薦指數: 80 %
It's important to note that using gl.lineWidth with any width other than 1.0 is not guaranteed to work according to the WebGL spec. 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 Howtousegl.lineWidth() AskQuestion Asked 4years,9monthsago Modified 4years,9monthsago Viewed 5ktimes 2 Everythingelseisworkingsmoothly,andthelinesarebeingdrawn.Itjustseemstobeignoringthegl.lineWidth()call.IsthereanythingelseIneedtodo? gl.lineWidth(17); gl.drawArrays(this.drawMode,0,totalVertices); IsthereanychanceI'moversimplifyingthings?CoulditperhapsneedtoknowwhichlineI'mspecifyingthewidthfor? javascriptgraphicswebgl Share Follow editedNov22,2017at22:01 Mot askedNov22,2017at21:37 MotMot 3311silverbadge44bronzebadges 1 ItesteditonFirefoxandChrome,butneitherworked. – Mot Nov22,2017at21:59 Addacomment | 2Answers 2 Sortedby: Resettodefault Highestscore(default) Trending(recentvotescountmore) Datemodified(newestfirst) Datecreated(oldestfirst) 8 It'simportanttonotethatusinggl.lineWidthwithanywidthotherthan1.0isnotguaranteedtoworkaccordingtotheWebGLspec.WebGLisbasedonOpenGLES2.0(WebGL2isbasedonOpenGLES3.0).TheOpenGLES3.0specsays Section3.5 Themaximumlinewidthsupportedmustbeatleastone. Ortoputthatanotherway,supportingwidths>1.0isnotrequired.ThesameistrueforOpenGLES2.0/WebGL1 Tofindouttheminimumandmaximumwidthsupportedforalineyou'resupposedtocallgl.getParameter(gl.ALIASED_LINE_WIDTH_RANGE)whichreturnsanarrayof2numbers.Thefirstnumberistheminimumwidthsupported,thesecondnumberisthemaximumwidthsupported.Bothallowedtobe1.0 So,youreallyshouldn'tusegl.lineWidthsinceyou'reusersmaynotgetanywidthotherthan1.0. Thatsaid,forawhilesomeimplementationssupportedalinewidth>1.0.ThatmostlychangedinJanuary2017whenWebGL2shipped.WebGL2,atleastonMacandLinuxisimplementedontopofOpenGL3.3'scoreprofile.FromtheOpenGLSpecCoreProfilespecappendixE E.2.1DeprecatedButStillSupportedFeatures Thefollowingfeaturesaredeprecated,butstillpresentinthecoreprofile. They mayberemovedfromafutureversionofOpenGL,andareremovedinaforwardcompatible contextimplementingthecoreprofile. Widelines-LineWidthvaluesgreaterthan1.0willgenerateanINVALID_VALUEerror. Thebrowsersdon'tgeneratetheerrorfromtheOpenGLspecsincetheOpenGLESspecrequiresnoerrorbutthelimitisstilltherebecausethedriverunderneathdoesn'tsupportthem. Ifyouwanttodrawlineslargerthan1youneedtorasterizethelinesyourself. Share Follow editedNov24,2017at9:44 answeredNov23,2017at3:49 gmangman 94.1k2929goldbadges239239silverbadges355355bronzebadges Addacomment | 2 gl.lineWidth()hasnoeffectincommonmodernbrowsers.The correspondingChromiumbugandFirefoxbugareclosedasWon'tFixand theWebGLspecificationnowdefinesthatgl.lineWidth()doesnot changethelinewidthanymore.Ifyouneedlinesofanywidthother than1px,considerdrawinganarrowstripoftriangles.-MozillaDeveloperNetwork BecauseonWindowsDirectXisusedasWebGLbackendwhichdoesnotsupportdrawinglineswiderthan1pixel. Share Follow answeredNov22,2017at23:27 LJᛃLJᛃ 7,02122goldbadges2323silverbadges3333bronzebadges 1 TheWebGLspecificationhasnotchanged.Ithasalwayssaidtheminimumlinewidthandmaximumlinewidthcanbe1.0.Alsothe1.0linelimitonsomeimplementationsofWebGLisnotjustDirectX – gman Nov23,2017at4:26 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?Browseotherquestionstaggedjavascriptgraphicswebgloraskyourownquestion. TheOverflowBlog Functionalprogrammingisanidealfitfordevelopingblockchains Environmentson-demand(Ep.479) FeaturedonMeta AnnouncingtheStackOverflowStudentAmbassadorProgram GoogleAnalytics4(GA4)upgrade StagingGroundWorkflow:QuestionLifecycle The[option]tagisbeingburninated CollectivesUpdate:WSO2launches,andGoogleGosunsets Linked 1 HowtopreventflickeringwhendrawingagridwithWebGL? 0 ThreeJShowtoaddcolorandlinethicknesstomeshloadedwithGLTFLoader Related 7623 HowdoJavaScriptclosureswork? 4341 Which"href"valueshouldIuseforJavaScriptlinks,"#"or"javascript:void(0)"? 8438 HowdoIcheckifanelementishiddeninjQuery? 7120 HowdoIremoveapropertyfromaJavaScriptobject? 7707 HowdoIredirecttoanotherwebpage? 6058 HowdoIincludeaJavaScriptfileinanotherJavaScriptfile? 8257 Whatdoes"usestrict"doinJavaScript,andwhatisthereasoningbehindit? 7413 HowtocheckwhetherastringcontainsasubstringinJavaScript? 10891 HowcanIremoveaspecificitemfromanarray? 6434 HowdoIreturntheresponsefromanasynchronouscall? HotNetworkQuestions IsURLrewritingine-mailasoundsecuritypractice? Componentthatrespondstoamperage Whatfactorswouldcontributetoamedievaleramechanicalrevolution? What'sthestorybehindkoboldsbeinglittlelizards? HowDoIReproducethisThree-ColumnFormatWithinEnumerate? Three-wayhexdriverthatIcanlocktosomething? HowtotakescreenshotsonmacOS Isthelifespanofaledaffecteddrasticallybythetypeofsensor? SkyrimcharacterprogressandSteamFamilySharing Arearbitrarynonemptyintersectionsofprincipalfiltersprincipal? WhydidthepilotsinTopGun:Maverickinvertatthecrestofthemountainbeforedescending? HowtogetthemostoutoftheBiblewithjustonereading? Identification:StarTrekVoyager-realcivilizationtreatedlikeAgeofEmpires(i.e.areal-timestrategygame) Whataresomewarningsignsthataresearchprojectwillfail? QGIS:Betterwaytoshowextentofprintcomposermapsinmaincanvas IsitappropriatetoapplyforanassistantprofessorjobinthesamedepartmentwhereIjuststartedmypostdoc? Istherealawagainstsigningacontracttodosomethingillegal? Howtojustifytime-sensitiveencounterswithoutitseemingconvenient? Ifalldemonsarebelievers,thenwhyaresomehumansatheists? Bookaboutspacefaringhumansthatcapturesomeformofalien/spirit(possiblynamed"angels")foundinspace Simplegroup-likeobjectsinothercategories DoesPSRRimprovewithmultipleLDOsinseries? HowcanIefficientlydiffaCSVfileagainstadatabase? Didsomethinglikefloppydiskjukeboxesforhomecomputersexistinthe70sor80s?Wouldthathavebeenafeasibleconcept? morehotquestions Questionfeed SubscribetoRSS Questionfeed TosubscribetothisRSSfeed,copyandpastethisURLintoyourRSSreader. lang-js Yourprivacy Byclicking“Acceptallcookies”,youagreeStackExchangecanstorecookiesonyourdeviceanddiscloseinformationinaccordancewithourCookiePolicy. Acceptallcookies Customizesettings
延伸文章資訊
- 1WebGLRenderingContext.lineWidth() - Web APIs | MDN
- 2用WebGL 畫線比我想像中地還難 - 半熟前端
Due to limitations of the OpenGL Core Profile with the WebGL renderer on most platforms linewidth...
- 3Line Width - WebGL - Khronos Forums
Hi, I find a function called "lineWidth". However, I cannot set the line width using this functio...
- 4glLineWidth
glLineWidth — specify the width of rasterized lines ... (If the rounding results in the value 0, ...
- 5Three.js线宽.lineWidth无效 - 郭隆邦
一般在windows操作系统平台上使用Three.js引擎的WebGL渲染器 WebGLRenderer 进行渲染的时候, .lineWidth 属性值设置为多少都是无效的,也就是说无论如何设置...