how does glDepthRange work? - Stack Overflow
文章推薦指數: 80 %
glDepthRange specifies a linear mapping of the normalized depth coordinates in this range to window depth coordinates. Regardless of the actual ... 2022DeveloperSurveyisopen!Takesurvey. Home Public Questions Tags Users Companies Collectives ExploreCollectives Teams StackOverflowforTeams –Startcollaboratingandsharingorganizationalknowledge. CreateafreeTeam WhyTeams? Teams CreatefreeTeam Collectives™onStackOverflow Findcentralized,trustedcontentandcollaboratearoundthetechnologiesyouusemost. Learnmore Teams Q&Aforwork Connectandshareknowledgewithinasinglelocationthatisstructuredandeasytosearch. Learnmore howdoesglDepthRangework? AskQuestion Asked 9years,4monthsago Modified 9years,4monthsago Viewed 7ktimes 5 0 Myvertexcordsare: GLfloatvertices[]= { 0.5f,0.5f,0.5f, -0.5f,0.5f,0.5f, -0.5f,-0.5f,0.5f, 0.5f,-0.5f,0.5f,//face1 0.5f,-0.5f,-0.5f, -0.5f,-0.5f,-0.5f, -0.5f,0.5f,-0.5f, 0.5f,0.5f,-0.5f,//face2 0.5f,0.5f,0.5f, 0.5f,-0.5f,0.5f, 0.5f,-0.5f,-0.5f, 0.5f,0.5f,-0.5f,//face3 -0.5f,0.5f,0.5f, -0.5f,0.5f,-0.5f, -0.5f,-0.5f,-0.5f, -0.5f,-0.5f,0.5f,//face4 0.5f,0.5f,0.5f, 0.5f,0.5f,-0.5f, -0.5f,0.5f,-0.5f, -0.5f,0.5f,0.5f,//face5 -0.5f,-0.5f,0.5f, -0.5f,-0.5f,-0.5f, 0.5f,-0.5f,-0.5f, 0.5f,-0.5f,0.5f//face6 }; now,iamchangingzcordsby: for(inti=0;i<24;i++) vertices[i*3+2]*=10 glDepthRange(0,10.0); Now,iamexpectingthatzcordswillbemappedto-0.5to0.5rangeduetoglDepthRangecallandicanseeapropercube,butitgiveso/pasthatofwhenicommentglDepthRangecallabovewithdistortedgeometry. opengldepthdepth-bufferdepth-testing Share Improvethisquestion Follow askedJan7,2013at12:22 debonairdebonair 2,39544goldbadges2525silverbadges6060bronzebadges Addacomment | 1Answer 1 Sortedby: Resettodefault Highestscore(default) Datemodified(newestfirst) Datecreated(oldestfirst) 6 Letmeciteyouthemanpages: Afterclippinganddivisionbyw,depthcoordinatesrangefrom-1to1,correspondingtothenearandfarclippingplanes.glDepthRangespecifiesalinearmappingofthenormalizeddepthcoordinatesinthisrangetowindowdepthcoordinates.Regardlessoftheactualdepthbufferimplementation,windowcoordinatedepthvaluesaretreatedasthoughtheyrangefrom0through1(likecolorcomponents).Thus,thevaluesacceptedbyglDepthRangearebothclampedtothisrangebeforetheyareaccepted. highlightsmine Inotherwords,youcan'treallyusedepthvaluesgreaterthan1;youhavetocalculatethemproperlybyyourself,instead.ItessentiallyconcludestosettingappropriatenearandfarvaluesinyourProjectionMatrixandtranslatingZcoordinateinyourModelviewMatrix,sothatallfinalZsarebetweentheaforementioned. Pleaseleaveacommentifyouneedmoredetailedexplanation. Share Improvethisanswer Follow editedJan7,2013at12:31 answeredJan7,2013at12:25 BartekBanachewiczBartekBanachewicz 37.6k77goldbadges8989silverbadges133133bronzebadges 2 Thanksforyourreply.Igotyourexplanationaboutthematrix.Butstillididnotget"glDepthRangespecifiesalinearmappingofthenormalizeddepthcoordinatesinthisrangetowindowdepthcoordinates"whatdoesitmean?canyougiveasmallexampleshowinghowglDepthRangeworks. – debonair Jan7,2013at12:44 It'sacomplicatedwaytosaythatyourcompressedrange(setbyglDepthRange)isstretchedinto(0,1):)(lookagainattheman-windowdepthvaluesarealwaystreatedastheyare(0,1))Iguessyoumightfinditquitenon-useful,butyoushouldn'tactuallyworryaboutit. – BartekBanachewicz Jan7,2013at12:54 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?Browseotherquestionstaggedopengldepthdepth-bufferdepth-testingoraskyourownquestion. TheOverflowBlog Makeyouropen-sourceprojectpublicbeforeyou’reready(Ep.444) Thescienceofinterviewingdevelopers FeaturedonMeta AnnouncingthearrivalofValuedAssociate#1214:Dalmarus Improvementstositestatusandincidentcommunication RetiringOurCommunity-SpecificClosureReasonsforServerFaultandSuperUser Temporarilypausingthesitesatisfactionsurvey StagingGround:ReviewerMotivation,Scaling,andOpenQuestions Related 42 WhenshouldIuseindexedarraysofOpenGLvertices? 19 OpenGLHowManyVAOs 1 Strategieswhenvertexattributesarewithdifferentindexing 15 CUDAcubemaptextures 0 TranslatingMatrizinGLSLwon'tworkwithvariables 6 DoesitmakesensetohaveindicesandnormalsinVBOs 0 ParseOBJfiletogetvertexnormals? 0 OpenGLworldcoordinatesfrommousecoordinates HotNetworkQuestions Wouldn'tMiller'splanetbefriedbyblueshiftedradiation? Longestgeometricprogressionofprimes IntheU.S.,whyisn'tturnoutandactivismproportionaltoinfluence? GAMmodelwarningmessage:stepfailureinthetaestimation HowcanaverbalreasoningquestionbesolvedwithMathematica? Softwareforcreatinghand-writtenslidesthatarerevealedgradually Ihaveanarmadaofteleportingskyfortresses.DoIstillneedanavy? Meaningandoriginoftheword"muist" WhydoesBendersay"Pleaseinsertgirder"? Iwant8bitsforeverycharacter! Whatdoyoucalladesperateattemptunlikelytosucceed? Pleasehelpmeclarifythissentenceabout'microtones'onGroveMusic Non-committingauthenticatedencryptionschemesvscommittingauthenticatedencryptionschemes WhentochangeoilfornewgenerationMazda? SelectonlyonepointinpolygonusingQGIS WhatisRNAVtransitionandwhatisthedifferencebetweenRNAVtransitionandRNAVSTAR CovidTestRequirementforDubaiTransitFromIrelandtoIndonesia GameinJamesBondfilm"FromRussiawithlove" Whyaren'tnegativefrequenciesfoldedinreconstructionofthealiasedsignal? CanWgatebewrittenonlyusingH,T? Whatdoestheidiomaticphrase"erronthesideof"mean? WhattapeformatdidtheNintendoFamicomDataRecorderuse? Tryingtouseacaralternatorforapowersource(notforcar) AnelegantwaytowritelongequationsinLaTex? morehotquestions Questionfeed SubscribetoRSS Questionfeed TosubscribetothisRSSfeed,copyandpastethisURLintoyourRSSreader. Yourprivacy Byclicking“Acceptallcookies”,youagreeStackExchangecanstorecookiesonyourdeviceanddiscloseinformationinaccordancewithourCookiePolicy. Acceptallcookies Customizesettings
延伸文章資訊
- 1OpenGL: glDepthRange的理解_Augusdi的博客
与x和y窗口坐标不同,在OpenGL中,z坐标总是被认为位于0.0~1.0的范围之间。可通过glDepthRange()调整。API中队glDepthRange的解释:After clippin...
- 2glDepthRange_百度百科
glDepthRange specifies a linear mapping of the normalized z coordinates in this range to window z...
- 3GL.glDepthRange() - Pike Reference Manual
After clipping and division by w, depth coordinates range from -1 to 1, corresponding to the near...
- 4glDepthRange 函式(Gl) - Win32 apps | Microsoft Docs
GlDepthRange 函式會指定從正規化裝置座標到視窗座標的z 值對應。
- 5glDepthRange:名稱,參數,描述,筆記,錯誤 - 中文百科全書
After clipping and division by w, z coordinates range from -1.0 to 1.0, corresponding to the near...