GL Error value 1285: Out of memory - java - Stack Overflow
文章推薦指數: 80 %
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
SortaMap
延伸文章資訊
- 1OpenGL 1285 Out of Memory Error - Planet Minecraft
After I got into single player I was getting out of memory errors, and alot of... ... OpenGL 1285...
- 2[SOLVED] OpenGL Error 1285 with no possible fix in sight
- 3[MCL-15600] me aparece, OpenGL Error: 1285 (Out of memory)
me aparece, OpenGL Error: 1285 (Out of memory) ... Fix Version/s: None. Component/s: Minecraft La...
- 4Opengl error 1285 out of memory - Java Edition Support
Opengl error 1285 out of memory ... Try assigning more memory to Minecraft. ... Minecraft uses as...
- 5Opengl error 1285 out of memory - SpigotMC
Hey guys! <3 OpenGL error : 1285 out of memory, and i tried a lot of steps,to resolve this proble...