GL Error value 1285: Out of memory - java - Stack Overflow

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

GL Error value 1285: Out of memory · What is the value of indicesCount at the time the error occurs? · What could be causing this is that you're somewhere often ... 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 GLErrorvalue1285:Outofmemory AskQuestion Asked 9years,8monthsago Modified 1yearago Viewed 11ktimes 3 1 I'mtryingtorenderasimplequadinafewdifferentways. Icandothisveryeasilywheneverythingisstoredinoneclass.ButIwanttobeabletorendermorethanasingleobjectonthescreensoI'mstartingtotakethecodeapartandputvariousbitsoffunctionalityinseparateclasses.Theproblemis,whenIputtherenderingfunctionalityintheEntityclass,Istartgettinganerror. Thisisthefunction,whichisisaVertexArrayObjectclass: publicvoidrender(){ glBindVertexArray(vaoID); glEnableVertexAttribArray(0); glEnableVertexAttribArray(1); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,vboiID); this.exitOnGLError("Beforerender"); glDrawElements(GL_TRIANGLES,indicesCount,GL_UNSIGNED_BYTE,0); this.exitOnGLError("Afterrender"); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,0); glDisableVertexAttribArray(0); glDisableVertexAttribArray(1); glBindVertexArray(0); this.exitOnGLError("errorrenderingvao"); } Again,allIhavedoneismovethisfromthemainclassintoaclassthatmanagestheVAOandtheoreticallyrendersit. It'sgivingmeerrorvalue1285,andtheerrorcallthatgetstheerroristheonelabeled"Afterrender".(exitOnGLError()isanerrorcheckingmethod). Error1285apparentlymeans"Outofmemory"whichispatentlyabsurdsinceI'musinga1megabyteimagefileand...Ijustcan'timaginemyfourvertexfloatbufferisfillingupallmyVRAM. Whatelsecouldbecausingthiserror? javaopengllwjgl Share Improvethisquestion Follow editedDec2,2014at18:50 genpfault 49.9k1010goldbadges8181silverbadges132132bronzebadges askedJan29,2013at22:37 SirYancySirYancy 16711goldbadge44silverbadges1212bronzebadges 8 WhatisthevalueofindicesCountatthetimetheerroroccurs?Whendoestheerrorhappen?Isitjustafteryoulaunchtheapplication,orafterafewseconds? – Bartvbl Jan29,2013at22:53 Whatcouldbecausingthisisthatyou'resomewhereoftenallocatinglargechunksofmemorywithoutdeletinganything(amemoryleak).It'snotpossibletoseefromyourcodewhattheactualreasonis,though. – Bartvbl Jan29,2013at22:59 1 indicesCount=6.Thereareonlysixunsignedbytesintheelementbuffer.Thewindowopensandclosesandneveractuallyrendersthefirstframe.Iwouldn'tevenknowwhichcodetoshowyoutofindthememoryleak.Theonlythingsthataresenttothegraphicscardaretheshaderprogram,aVAO/VBOpair,anda2048*2048pixeltexture.Itisunfathomabletomethatthatsmallamountofdatacouldbegeneratingamemoryleaksufficienttooverloadmygraphicscard.Idon'tthinkit'samemoryleak.Ithinkthere'ssomethingelsehappening. – SirYancy Jan29,2013at23:40 hm.DidyouactuallycreateanopenGLcontext?Whatcallsdidyouusetocreateyourscene?TheitemsthemselvesshouldindeednotstuffuptheVRAM.Thoughbeawarethat2048x2048isthemaximumtexturesizeaccordingtotheopenGLstandard.Ifitclosesinstantlythere'sindeednomemoryleak. – Bartvbl Jan29,2013at23:50 2 Whyareyouenablinganddisablingattributearrayswhenyou'reusingaVAO?VAOsstoreallofthevertexstateneededtorender. – NicolBolas Jan30,2013at1:29  |  Show3morecomments 4Answers 4 Sortedby: Resettodefault Highestscore(default) Trending(recentvotescountmore) Datemodified(newestfirst) Datecreated(oldestfirst) 2 FYIIhadthissameerror,anditwascausedbythefactthatIfailedtoaddthecalltoglBufferData,whichiswhereyouactually"sendthedata"toopengl. glBufferData(GL_ARRAY_BUFFER,sizeof(GLSL_XYZNDUV_Item)*p->iNum_verts,p->pVerts,GL_STATIC_DRAW); glBufferData(GL_ELEMENT_ARRAY_BUFFER,sizeof(GLushort)*p->iNum_tris*2,p->pIndices,GL_STATIC_DRAW); Share Improvethisanswer Follow editedSep20,2021at13:51 genpfault 49.9k1010goldbadges8181silverbadges132132bronzebadges answeredDec2,2014at17:21 Archon808Archon808 16211silverbadge88bronzebadges Addacomment  |  2 SharingapossibleanswerforthosecomingherefromGoogle. glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,indexBuffer); glBufferData(GL_ARRAY_BUFFER,sizeof(indices),&indices[0],GL_STATIC_DRAW); Notethecopypasteerrorinbold.Thiscausederror1285andquiteabitofheadscratchingforquitesometime. Share Improvethisanswer Follow answeredSep26,2014at9:47 melfarmelfar 35033silverbadges1515bronzebadges Addacomment  |  0 YoushouldfirstverifythatyoumakeallOpenGLclassinthecorrectorder,e.g.youshouldonlybindtheVBOswhencreatingtheVAO,notwhenrenderingit. Here'showIorderthecallsinmyVAOclass: //creation array=glGenVertexArrays(); glBindVertexArray(array); vertices=glGenBuffers(); glBindBuffer(GL_ARRAY_BUFFER,vertices); glBufferData(GL_ARRAY_BUFFER,b,usage); for(attributes){ glEnableVertexAttribArray(index); glVertexAttribPointer(index,dimension,type,false,bytesPerVertex,offset); } if(indicesareused){ indices=glGenBuffers(); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,indices); glBufferData(GL_ELEMENT_ARRAY_BUFFER,buffer,usage); } //render glBindVertexArray(array); program.use();//bindsshaderprogramandtextures if(indices==-1) glDrawArrays(mode,0,size); else glDrawElements(mode,size,indicesType,0); Share Improvethisanswer Follow answeredJan13,2014at15:58 NjolNjol 3,2411616silverbadges3232bronzebadges Addacomment  |  -1 I'vejustrunintothesameerrorwhenrenderinga.objfilewithOpenGLonAndroid11(worksfineonAndroid9). ThereseemstobeabuginOpenGLmakingitthrowtheoutofmemoryerrorwheneverthesourceverticesinthe.objfilearedefinedintheVertexnormalindiceswithouttexturecoordinateindicesformat(f113//11376//7677//77).Tocircumventtheerror,justaddasingletexturecoordinatetothefile(e.g.vt0.5001)andreferenceitineverysingleface(turnf113//11376//7677//77intof113/1/11376/1/7677/1/77) Share Improvethisanswer Follow answeredSep20,2021at11:32 LarsLars 11411silverbadge33bronzebadges 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?Browseotherquestionstaggedjavaopengllwjgloraskyourownquestion. TheOverflowBlog MeetSaves:thetooltohelpyouorganizeyourfavoritecontentonStack... MeettheAIhelpingyouchoosewhattowatchnext FeaturedonMeta BookmarkshaveevolvedintoSaves(temporarilydisabled) Recentcolorcontrastchangesandaccessibilityupdates Revieweroverboard!Orarequesttoimprovetheonboardingguidancefornew... CollectivesUpdate:RecognizedMembers,Articles,andGitLab The[placement]tagisbeingburninated ShouldIexplainotherpeople'scode-onlyanswers? Visitchat Related 7534 IsJava"pass-by-reference"or"pass-by-value"? 1827 SortaMapbyvalues 2281 HowtogetanenumvaluefromastringvalueinJava 2004 HowdoIbreakoutofnestedloopsinJava? 2593 HowdoIdeterminewhetheranarraycontainsaparticularvalueinJava? 3621 HowcanIcreateamemoryleakinJava? 1 LWJGL-GamecrashesafterglEnableVertexAttribArray(1) 1 LWJGLdoesn'trenderanything 3 PyOpenGL-MinimalglDrawArraysExample HotNetworkQuestions Thecomputercan'tdoanythingIcouldn'tdowithpenandpaper Iam16.CanmyparentslegallytransfermymoneyIhaveearnedfrommyownjobtotheiraccountandtakeit? HowdoIrepairasplitstudinload-bearingwall ExamQuestionwithTwoAnswers Usingregexwithfind What'sthemeaningofthecauseofcommonsense? Expectednumberofrandomcomparisonsneededtosortalist Whywouldametalformanioniccompoundwithanonmetalfromalowerperiod? Aptincorrectlyguessespackagenamesinsteadofgivinganerror IndividualdoctorateinGermany–registeringfromabroad Whydoesmathneedtobepracticedandexercised,whenL1LinguisticCompetenceissubconscious? Howtoexplainquantitycompetitionandpricetaking? Can'tcreatefilesordirectoriesthatstartsfrom'com1'to'com9' DoIhavetodeclarepersonalitemsatCustomsinDublinAirport? Is"illegal"anexampleofnasalplaceassimilationinEnglish? Why,sinceEarthisinfreefalltowardsSun,aretidesaffectedbySun'sgravity?Whyaren'ttheoceans"weightless"likeastronauts? Apostapocalypticstoryaboutafatheranddaughterwhosurviveanalienattackthatwipesouthumanity HowwasthefirstreleaseofJava(JDK1.0)used? Whatisthenameofthisview,thatconsciousnessbuildsreality? GenerateaTiefling'sTraits Deleteallduplicatefiles Asamanager,woulditbewrongtocreatesecretPTOsothatIcankeepmystaremployees? SixstringbassandGuitartheory WhatinnovationhelpedCD-ROMspeedsincreaseexponentially? morehotquestions Questionfeed SubscribetoRSS Questionfeed TosubscribetothisRSSfeed,copyandpastethisURLintoyourRSSreader. lang-java Yourprivacy Byclicking“Acceptallcookies”,youagreeStackExchangecanstorecookiesonyourdeviceanddiscloseinformationinaccordancewithourCookiePolicy. Acceptallcookies Customizesettings  



請為這篇文章評分?