Drawing thin 3D lines with modern OpenGL - Reddit
文章推薦指數: 80 %
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
延伸文章資訊
- 1Sample Modern OpenGL Programs - UCSD Math Department
SimpleDrawModern shows how to draw points, lines, line strips, line loops, and triangles. It incl...
- 2Hello Triangle - LearnOpenGL
In modern OpenGL we are required to define at least a vertex and fragment ... and back of all tri...
- 3Drawing a line in modern OpenGL - c++ - Stack Overflow
Create an array with the corners points of the line strip. The first and the last point define th...
- 4Drawing Lines is Hard - Matt DesLauriers - Svbtle
Twitter: @mattdesl Drawing lines might not sound like rocket science, but it's damn difficult to ...
- 5Drawing Antialiased Lines with OpenGL | by Mapbox
I worked on an experiment that uses only two vertices per line segment, but this way of drawing l...