android - Strange artifacts when rendering lots of bitmaps -
i'm writing simple 2d game engine , rendering various objects locked surfacevew calling canvas.drawbitmap (all same source bitmap not 1:1 source destination scaling).
everything appears work expected until there lot of calls per frame drawbitmap. when happens see stall (100ms or so) accompanied effect looks if several frames of rendering have occurred together, i.e. objects drawn twice @ 2 screen locations or pair of objects moving @ same speed appear momentarily closer or further apart.
the application structured follows (simplified sake of example);
initialisegameobjects(); while(quit==false) { processgamelogic(); // update object positions canvas c = surface_holder.lockcanvas(); if (c != null) { drawgameobjects(c); // draw objects surface_holder.unlockcanvasandpost(c); } } as understand it, canvas holder draw requests executed when post issued. presumably there limit number of requests can hold , i'm wondering if i'm exceeding limit (i'm drawing hundred small bitmaps depending on what's on screen @ 1 time) , inadvertently provoking kind of flush , upsetting double buffering in way, although i've not managed find documentation confirm or disprove this.
does have idea might going on?
regards, steve
you need sychronize calls canvas drawing. check example of game driving thread: ondraw() not fired, nothing drawn in surfaceview - android
edit: think may related problem: android surfaceview/canvas flickering after trying clear it
Comments
Post a Comment