gfx outside the screen

BlitzMax Forums/BlitzMax Beginners Area/gfx outside the screen

hub(Posted 2006) [#1]
Hi !

what's happen if i draw a gfx object (plot a point, draw an image) outside the screen ?

1 - bmax test that this object is outside the screen and not draw it, in fact do nothing. No collision check too. Cool !

2 - bmax draw it, but you can't see it, coz it outside the screen ;-). It also perform collision tests...

I ask this because i drawing some objects outside the screen in my tiled spaceship vertical scrolling game. in my mind bmax use 1). Just want to know if i must check gfx outside the screen if it is 2) and have a better framerate !!!

Thanks !


Cruis.In(Posted 2006) [#2]
anything outside the screen is automatically culled, so I am told, so that unless it is in your view, it ain't drawn.
it'll still be there data wise, so collision would still work if you fired at something off screen.


ImaginaryHuman(Posted 2006) [#3]
Yah, my Cruis.In said it all. It's actually the directx or opengl driver that handles deciding what to do with off-screen stuff and generally if it's outside of the screen edges the graphics card simply wont draw it. For example i notice that if you draw a large object and it gives a certain framerate, as the object starts going off the edge of the screen the framerate goes up.


hub(Posted 2006) [#4]
Graphics 800,600

Global x = GraphicsWidth()/2
Global y = GraphicsHeight()/2

	Local CurFPS
	Local fpscounter	
	
	Local FPScheckTime:Int=MilliSecs()
	
	
While Not KeyDown (KEY_ESCAPE)

	Cls
	
	
	DrawRect x-200,y-200,400,400
	
	If KeyDown (KEY_UP) Then y = y - 1
	If KeyDown (KEY_DOWN) Then y = y + 1

	If MilliSecs() > FPScheckTime Then
		FPScheckTime:+ 1000
		curFPS = fpscounter
		fpscounter = 1
	Else
		fpscounter = fpscounter + 1
	End If		

	DrawText "FPS=" + String (CurFPS) , 0 , 0
	DrawText "x=" + String(x) + ",y=" + String(y),0,20

			
	Flip 0

Wend


fps = 233 rect inside screen
fps = 253 rect outside screen


Brendane(Posted 2006) [#5]
"what's happen if i draw a gfx object (plot a point, draw an image) outside the screen?"

It takes on physical form and has a life of its own..... my advice, don't do it!... and if you do, don't let it get wet or feed it after midnight.


ImaginaryHuman(Posted 2006) [#6]
Interesting. Maybe gfx card/driver dependent and depends how they do the clipping. Raw GL on my system is faster offscreen than on. Maybe Max2d is slower due to clip planes etc.