Buggy code:
public class Play extends BasicGameState { final int MIN_ZOOM = 1 ; final int MAX_ZOOM = 96 ; Vector < WorldChunk > relevantChunks = new Vector < WorldChunk > ( ) ; Vector < Vector < Actor > > relevantActors = new Vector < Vector < Actor > > ( ) ; public final int state ; public PlayerCharacter character = null ; public enum rightPaneStates { equipment , consumables , buffs , equipmentSpecific , consumableSpecific , buffSpecific ; } public Vector < DynamicActor > dynamicActors ; int staticSize ; int dynamicSize ; final int DYNAMIC_MAX = 100 ; final int STATIC_MAX = 200 ; FloatBuffer d_dynamic ; FloatBuffer d_static ; float [ ] h_dynamic ; float [ ] h_static ; public Play ( int statein ) { } @ Override public void init ( GameContainer gc , StateBasedGame sbg ) throws SlickException { } @ Override public void render ( GameContainer gc , StateBasedGame sbg , Graphics gr ) throws SlickException { staticSize = 0 ; dynamicSize = 0 ; dynamicActors . clear ( ) ; Map < String , Image > texturesScaled = new HashMap < String , Image > ( ) ; float startX = ( ( float ) ( ( ( character . location . X ) - ( ( 0.5 * ( gc . getWidth ( ) ) ) // ( Game . zoom ) ) ) - 1 ) ) ; float endX = ( ( float ) ( ( character . location . X ) + ( ( 0.5 * ( gc . getWidth ( ) ) ) // ( Game . zoom ) ) ) ) ; float startY = ( ( float ) ( ( ( character . location . Y ) - ( ( 0.5 * ( gc . getHeight ( ) ) ) // ( Game . zoom ) ) ) - 1 ) ) ; float endY = ( ( float ) ( ( character . location . Y ) + ( ( 0.5 * ( gc . getHeight ( ) ) ) // ( Game . zoom ) ) ) ) ; for ( float x = startX ; x < endX ; x ++ ) { <START_BUG> for ( float y = startY ; y < endY ; y ++ ) { <END_BUG> try { float drawX = ( ( ( Math . round ( x ) ) - startX ) - 1 ) * ( Game . zoom ) ; float drawY = ( ( ( Math . round ( y ) ) - startY ) - 1 ) * ( Game . zoom ) ; world . backgroundImages [ Math . round ( x ) ] [ Math . round ( y ) ] . getScaledCopy ( zoom , zoom ) . draw ( drawX , drawY ) ; } catch ( ArrayIndexOutOfBoundsException e ) { } } } int RenderedObjects = 0 ; for ( int i = 0 ; i < ( relevantActors . size ( ) ) ; i ++ ) { for ( int i1 = 0 ; i1 < ( relevantActors . get ( i ) . size ( ) ) ; i1 ++ ) { Actor a = relevantActors . get ( i ) . get ( i1 ) ; if ( a . isRendered ) { int x ; int y ; x = ( ( int ) ( ( ( ( a . location . X ) - ( character . location . X ) ) * ( Game . zoom ) ) + ( ( gc . getWidth ( ) ) // 2 ) ) ) ; y = ( ( int ) ( ( ( ( a . location . Y ) - ( character . location . Y ) ) * ( Game . zoom ) ) + ( ( gc . getHeight ( ) ) // 2 ) ) ) ; if ( ( ( ( ( x > ( - ( Game . zoom ) ) ) && ( y > ( - ( Game . zoom ) ) ) ) && ( x < ( gc . getWidth ( ) ) ) ) && ( y < ( gc . getHeight ( ) ) ) ) && ( ( a . displayImage ) != null ) ) { if ( ! ( texturesScaled . containsKey ( a . displayImage ) ) ) { texturesScaled . put ( a . displayImage , textures . get ( a . displayImage ) . getScaledCopy ( zoom , zoom ) ) ; } RenderedObjects ++ ; texturesScaled . get ( a . displayImage ) . draw ( x , y ) ; } } } } IntBuffer errorBuff = BufferUtils . createIntBuffer ( 1 ) ; d_dynamic . put ( h_dynamic ) ; d_dynamic . rewind ( ) ; CLMem dynamicMem = CL10 . clCreateBuffer ( context , ( ( CL10 . CL_MEM_WRITE_ONLY ) | ( CL10 . CL_MEM_COPY_HOST_PTR ) ) , d_dynamic , errorBuff ) ; Util . checkCLError ( errorBuff . get ( 0 ) ) ; d_static = BufferUtils . createFloatBuffer ( STATIC_MAX ) ; d_static . put ( h_static ) ; d_static . rewind ( ) ; CLMem staticMem = CL10 . clCreateBuffer ( context , ( ( CL10 . CL_MEM_WRITE_ONLY ) | ( CL10 . CL_MEM_COPY_HOST_PTR ) ) , d_static , errorBuff ) ; Util . checkCLError ( errorBuff . get ( 0 ) ) ; CLMem resultMem = CL10 . clCreateBuffer ( context , CL_MEM_READ_ONLY , ( ( DYNAMIC_MAX ) * 4 ) , errorBuff ) ; Util . checkCLError ( errorBuff . get ( 0 ) ) ; collideKernel . setArg ( 0 , dynamicMem ) ; collideKernel . setArg ( 1 , staticMem ) ; collideKernel . setArg ( 2 , resultMem ) ; collideKernel . setArg ( 3 , STATIC_MAX ) ; collideKernel . setArg ( 4 , DYNAMIC_MAX ) ;

Fix:
for ( float y = startY ; y < ( endY + ( Game . zoom ) ) ; y ++ ) {