Rect / Oval with LockBuffer

Blitz3D Forums/Blitz3D Programming/Rect / Oval with LockBuffer

Xaron(Posted 2009) [#1]
Hi all,

I just wonder why do the commands Rect and Oval NOT work within a LockBuffer/Unlockbuffer block while Line does work?

That works:
Graphics3D 640,480
SetBuffer BackBuffer()
While Not KeyHit(1)
  Rect 100,100,50,50,1
  Line 200,200,100,100
  Flip
Wend


That doesn't (regarding the Rect):
Graphics3D 640,480
SetBuffer BackBuffer()
While Not KeyHit(1)
  LockBuffer BackBuffer()
  Rect 100,100,50,50,1
  Line 200,200,100,100
  UnlockBuffer BackBuffer()
  Flip
Wend



Warner(Posted 2009) [#2]
I think the reason could be, that line uses WritePixel internally, and Oval and Rect don't. But it is just a guess.


_Skully(Posted 2009) [#3]
From what I recall you cannot use Oval and Rect with lockbuffer, but you can draw your own quite fast with a simple function. Watch drawing an oval though... if you draw outside the buffer limits your looking at a crash

I am surprised that line works.. perhaps Warner is correct on that one

cheers


Beaker(Posted 2009) [#4]
Warner is correct AFAIR. Originally Line, Rect and Oval all used Windows built in functions, but later Line was rewritten to make it much faster.


Xaron(Posted 2009) [#5]
Thx guys!