Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
HW image version of this little stupid thing
#14
(09-12-2023, 07:41 PM)TerryRitchie Wrote: The reason you're getting 1000 FPS in hardware mode is because that's the upper limit that can be calculated with TIMER(.001). Only when hardware is taxed enough will the frame rate drop below 1000. The program crashes for me when I try to go a few more than 8000 sprites. Perhaps someone with a better video card and more RAM can tax the hardware layer enough to start seeing the FPS drop below 1000 in hardware mode. (or someone has a better timing method I can use)

Try this little demo to showcase the difference in speed between Hardware Images and Software Images:

Code: (Select All)
DIM AS LONG HWscreen, SWscreen, DisplayScreen, TempScreen
DisplayScreen = _NEWIMAGE(1280, 720, 32)
SWscreen = _NEWIMAGE(64, 8, 32)
TempScreen = _NEWIMAGE(64, 8, 32)

'draw a few characters for screen display
_DEST TempScreen 'make a temp software screen to print on
_FONT 8 'size 8 font
_PRINTSTRING (0, 0), "Hardware" 'print the word "Hardware"
HWscreen = _COPYIMAGE(TempScreen, 33) 'make a copy of that temp screen as a hardware screen
_FREEIMAGE TempScreen 'free the temp screen


_DEST SWscreen 'Draw on a software screen
_FONT 8 'same size font 8
_PRINTSTRING (0, 0), "Software" 'And print the word Software on this screen
_DEST DisplayScreen
SCREEN DisplayScreen

HardwareMode = 0 'let's start out in software mode


xdirection = 1: ydirection = 1

DO

    IF TIMER > t# THEN
        IF FPS > maxFPS THEN maxFPS = FPS
        _TITLE "FPS:" + STR$(FPS) + " -- MaxFPS:" + STR$(maxFPS)
        t# = TIMER
        FPS = 0
    ELSE
        FPS = FPS + 1
    END IF

    x = x + xdirection
    y = y + ydirection
    IF x < 0 OR x > _WIDTH THEN xdirection = -xdirection
    IF y < 0 OR y > _HEIGHT THEN ydirection = -ydirection


    IF HardwareMode THEN
        _DISPLAYORDER _HARDWARE
        _PUTIMAGE (x, y), HWscreen
    ELSE
        _DISPLAYORDER _SOFTWARE
        CLS
        _PUTIMAGE (x, y), SWscreen, DisplayScreen
    END IF
    k = _KEYHIT
    SELECT CASE k
        CASE 27: SYSTEM
        CASE ASC("H"), ASC("h"): HardwareMode = -1: maxFPS = 0: FPS = 0
        CASE ASC("S"), ASC("s"): HardwareMode = 0: maxFPS = 0: FPS = 0
    END SELECT
    _DISPLAY
LOOP

On my PC, I get about 100 FPS for the software image animation, and about 130,000 FPS for the hardware image animation.

I think that's enough to showcase a slight difference in the performance between the two.  Wink
Reply


Messages In This Thread
RE: HW image version of this little stupid thing - by SMcNeill - 09-12-2023, 09:46 PM



Users browsing this thread: 15 Guest(s)