Fullscreen

Post your coding questions such as 'how to' here.
Post Reply
Buckethead
Newcomer
Posts: 16
Joined: Thu Sep 20, 2007 9:53 am

Fullscreen

Post by Buckethead » Thu Sep 20, 2007 10:32 am

Hi,

When I'm running my routine, it's kind smooth in windowed mode (full frame rate at 60 FPS on a 22" LCD) but it is not in fullscreen (30 FPS!)
I tryed differents bit depth, but it was the same, half speed only.

Also in windowed mode it's fast but the pixel looks like a line when the step is more than 1 pixel.
Here's the code, it's a 2D starfield. Sorry for the bad english.

Thanks for reading.

Code: Select all


' Windowed mode
SCREEN 800,600

' Fullscreen, it was half the speed on my computer (XP SP2, E2140 @ 3.2GHz, 2Go, 8800 GTS 320)
' SCREEN 800,600,32,0

' I don't know if it's ok to use this command here. I know it's for resize or rotate.
Smooth2D ON

'FPS color text
Color 0,255,0

'We need to keep and add/change values to stars
Dim star(1000)

' We want different X values for stars, otherwise they all start to the same point 
For i = 1 To 600
star(i) = Rnd(800)
Next i

Repeat

'The lock screen function amazed me in term of speed.
Lock SCREEN()

'vit = speed, each lines (600) it adds 1 to 16 for paralax effect 
'I need to know how to set RGB in PutPixel, I though it was something like 65535*R +255*G +B
'Also I'll like to know if there's a function like " inc var n" instead var = var + n 

For i = 1 To 600
vit = 1 + Abs(16*Sin(i^3))
star(i) = star(i) + vit
If star(i) > 800 Then star(i) = 0
PutPixel star(i),i,30000000-20*vit
Next i

Unlock SCREEN()
Text 1,1,FPS()
DrawScreen

' I didn't put a command to clear the background, no cls or black box. Why it works ? It could be annoying for some effects. Thanks.

Forever

User avatar
mikeful
Moderator
Moderator
Posts: 523
Joined: Mon Aug 27, 2007 8:36 pm
Location: Vaasa, Finalnd
Contact:

Re: Fullscreen

Post by mikeful » Thu Sep 20, 2007 1:38 pm

DrawScreen clears automatically screen. It can be turned off with this.

Code: Select all

Drawscreen off
Pelejä: Pelasta puhe, Grinder
Muuta: Blogi, Twitter

Buckethead
Newcomer
Posts: 16
Joined: Thu Sep 20, 2007 9:53 am

Re: Fullscreen

Post by Buckethead » Thu Sep 20, 2007 2:31 pm

Ha nice with drawscreen. Otherwise it seem's that I can't get more than 31 FPS in any fullscreen mode (320x200 to 1680x1050 @ 8,16 & 32) even without stuff.

Code: Select all

SCREEN 800,600,16,0
Repeat
Print FPS()
'Text 1,1,FPS()
DrawScreen
Forever

User avatar
koodaaja
Moderator
Moderator
Posts: 1583
Joined: Mon Aug 27, 2007 11:24 pm
Location: Otaniemi - Mikkeli -pendelöinti

Re: Fullscreen

Post by koodaaja » Thu Sep 20, 2007 3:57 pm

Buckethead wrote:Ha nice with drawscreen. Otherwise it seem's that I can't get more than 31 FPS in any fullscreen mode (320x200 to 1680x1050 @ 8,16 & 32) even without stuff.

Code: Select all

SCREEN 800,600,16,0
Repeat
Print FPS()
'Text 1,1,FPS()
DrawScreen
Forever
Never use print and drawscreen together. Use text instead. ( and why is it commented out? ) But try using a window as big as your screen resolution. I guess it wont be much faster than fullscreen.

Buckethead
Newcomer
Posts: 16
Joined: Thu Sep 20, 2007 9:53 am

Re: Fullscreen

Post by Buckethead » Thu Sep 20, 2007 4:08 pm

My screen setting is 1680x1050x32. In fullscreen the frame rate is never > 31 FPS but a 1680x1050 window can be 60.
I wanted to test if there was something with the text functions, I even tried other font, but it doesn't accept a system font like terminal (it has no antialias)

User avatar
koodaaja
Moderator
Moderator
Posts: 1583
Joined: Mon Aug 27, 2007 11:24 pm
Location: Otaniemi - Mikkeli -pendelöinti

Re: Fullscreen

Post by koodaaja » Thu Sep 20, 2007 4:10 pm

Buckethead wrote:My screen setting is 1680x1050x32. In fullscreen the frame rate is never > 31 FPS but a 1680x1050 window can be 60.
I wanted to test if there was something with the text functions, I even tried other font, but it doesn't accept a system font like terminal (it has no antialias)
Hmm. Have you tried changing framelimit? Call

Code: Select all

FrameLimit 40
For example. It might be that for some odd reason fullscreen has lower default framelimit.

Buckethead
Newcomer
Posts: 16
Joined: Thu Sep 20, 2007 9:53 am

Re: Fullscreen

Post by Buckethead » Thu Sep 20, 2007 4:34 pm

FrameLimit 40 is 31 FPS in fullscreen mode with stuff or not.
It could be a problem with my machine, I wonder. It would be nice if someone tried this code and said how he got.

Code: Select all

SCREEN 800,600,16,0
Repeat
Text 1,1,FPS()
DrawScreen
Forever

User avatar
Murskaaja
Member
Posts: 92
Joined: Tue Aug 28, 2007 8:19 pm
Contact:

Re: Fullscreen

Post by Murskaaja » Thu Sep 20, 2007 4:43 pm

I got 61 with my old laptop. I've had similar problems in the past you're having now but there's nothing a reboot hasn't fixed yet ;)
ASCII star wars Xtreme | Cool Bombers | Combat (kehitteillä)

RedShadow productions

Buckethead
Newcomer
Posts: 16
Joined: Thu Sep 20, 2007 9:53 am

Re: Fullscreen

Post by Buckethead » Thu Sep 20, 2007 6:27 pm

Thanks for your feedback.
The problem was DrawScreen function
mode: 0=GFX Card VSync, 1=CPU Vsync (default)
(weird because it's the default value)

DrawScreen 1 , 1 gives the same framerate than windowed mode now :D


Edit: Weird. Today it worked in full frame rate without the need to put "1,1" after DrawScreen, too bad, for a few time.

Post Reply