Buffer and Read/Write pixel problems ...

Blitz3D Forums/Blitz3D Beginners Area/Buffer and Read/Write pixel problems ...

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.

What seems to be the problem. What I see here is a piece of code which takes the existing buffer and copies it onto itself (this ultimately assumes FrontBuffer is the set buffer). If it worked you would see nothing apparent happening.

Try looking at this:
Dim pix(vh_scrwidth,vh_scrheight) 

CopyBuffer = FrontBuffer()	; Change this to the buffer you're copying from
TargetBuffer = BackBuffer()	; again, change this how you want
PreviousBuffer = GraphicsBuffer() ; So we can reset back to orignal buffer


SetBuffer CopyBuffer		; Important to tell the compiler which buffer you're reading
LockBuffer(CopyBuffer)
For y=0 To vh_scrwidth 
	for x=0 To vh_scrheight 
		pix(x,y)=ReadPixelFast(x,y) 
	Next 
Next
UnlockBuffer CopyBuffer

SetBuffer TargetBuffer
LockBuffer(TargetBuffer)
For y=0 To vh_scrwidth 
	For x=0 To vh_scrheight 
		WritePixelFast x,y,$00,$00,$00,pix(x,y) 
	Next 
Next 
UnlockBuffer (TargetBuffer)
SetBuffer PreviousBuffer