Writepixelfast....way to slow

BlitzPlus Forums/BlitzPlus Programming/Writepixelfast....way to slow

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Simon S:

It's in this bit of code:

	imagebank=LockedPixels(buffer) 
	pitch=LockedPitch(buffer) 
	
	; copy bank to image line by line 
	For y=0 To DHEIGHT-1 
		yoff=y*pitch 
		For x=0 To DWIDTH-1 
			PokeInt imagebank,yoff+(x*4),image(x,y) 
		Next 
	Next 


For the "Y increment" you need to use the pitch (LockedPitch(buffer)) of the screen buffer instead of Graphicswidth()*4 as these two values can vary. This is the problem I ran into when first experimenting with LockedPixels.