Drawing thin 3D lines with modern OpenGL - Reddit

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

Drawing thin 3D lines with modern OpenGL. I'm a bit confused on how render thin 3D lines without using GL_LINES. Ideally I want to have a similar look to ... Foundtheinternet!r/openglPosts7Postedby8yearsagoDrawingthin3DlineswithmodernOpenGL I'mabitconfusedonhowrenderthin3DlineswithoutusingGL_LINES.IdeallyIwanttohaveasimilarlooktoBlendertostart.OnceIgettothatpointIthinkIunderstandhowtoimplementvaryingwidths,textures,shadereffects,etc.InBlendernomatterhowclose/farIgettoalineitalwaysappearstobe1pixelwide.ItsoundslikeIneedtocreatea2dquadandalignittothescreen?Istherea"safe"minimumwidthtouse?Iguessit'stheprojectionI'mhavingtroublewith.I'dliketoavoidanykindofgeometryshadersduetohardwaresupport.I'vebeengoingthroughthispaper/codebutI'mhopingasimpleexplanationmightkickmybrainintogear.11commentssharesavehidereport100%UpvotedSortby:best level1·8yr.agoWhydoyounotwanttouseGL_LINES?(sincerequestion,notasuggestiontouseit;Idon'tknow)6ReplyShareReportSaveFollowlevel2Op·8yr.agoIwantsomethingthatworksconsistentlyacrossvendorsandsomethingIhavemorecontroloverforthingslikeantialiasingorshadereffects.2ReplyShareReportSaveFollowlevel2·8yr.agoAMDchipstreatallGL_LINE_WIDTH'sas1...soit'snotreallythebestsupportedfeature.That'sthemainproblemI'mawareofwithGL_LINES(worksonNvidiacards).1ReplyShareReportSaveFollowContinuethisthread level2[deleted]·8yr.agoIdon'tthinkthefunctionisavailableonOpenGLES.It'sapain.0ReplyShareReportSaveFollowContinuethisthread level1·8yr.agoLineshavealwaysthesamewidthunlessyoudosomethingspecial.2ReplyShareReportSaveFollowlevel2Op·8yr.ago·edited8yr.agoIwanttodrawthemwithtriangles.2ReplyShareReportSaveFollowContinuethisthread level1·8yr.agoIlookedatthisforimplementation:http://www.codeproject.com/Articles/199525/Drawing-nearly-perfect-D-line-segments-in-OpenGL.I'veusedageometryshadertoreplacelineswithtrianglepairs,butIguessyoucanreplaceitinyourcodebygeneratingtherequiredtrianglesyourself.Youcanstoreanattributeforeachverticetohelpcalculatingthepositionfortherequiredwidth(youwanttobeinscreenspaceforcalculatingapixelswidth)2ReplyShareReportSaveFollowlevel1·8yr.agoI'vebeenquestioningthismyselflately,Ithinkyouhavetostorethetwopointsintoabufferobjectandsendittotheshaderstointerpolatefragmentsbetweenthem.Youcangetprettycreativewiththewayyouwouldrenderthefragmentinsidethefragshader.1ReplyShareReportSaveFollowAboutCommunityr/openglNews,informationanddiscussionaboutOpenGLdevelopment.20.9kMembers20OnlineCreatedJun6,2009JoinToppostsjuly17th2014Toppostsofjuly,2014Topposts2014BacktoTop Advertisement



請為這篇文章評分?