2D drawing slow as hell
Re: 2D drawing slow as hell
yes this is faster (2500 fps) but this method is single buffered. just try with DrawText() and you will see the problem.
why decent speed on XP and not on seven ?
why decent speed on XP and not on seven ?
Re: 2D drawing slow as hell
Wow 2500,
here only 540 FPS Windows 7 32
Video Intel G33/G31
here only 540 FPS Windows 7 32
Video Intel G33/G31
Re: 2D drawing slow as hell
Workstation: Win7 x86, Intel Xeon Quad Core, NVIDIA Quadro FX 580
54 FPS / xorc1zt
2.400 FPS / netmaestro

54 FPS / xorc1zt
2.400 FPS / netmaestro

"Daddy, I'll run faster, then it is not so far..."
-
- Addict
- Posts: 1482
- Joined: Tue Feb 22, 2011 1:16 pm
Re: 2D drawing slow as hell
Do you really have to ask? It's common knowledge that Vista and 7 are slower and more bloated than XP. You're now experiencing it firsthand.xorc1zt wrote:why decent speed on XP and not on seven ?

Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!
PureBasic: Born in 1998 and still going strong to this very day!
Re: 2D drawing slow as hell
Which isnt true at all.MachineCode wrote:Do you really have to ask? It's common knowledge that Vista and 7 are slower and more bloated than XP.xorc1zt wrote:why decent speed on XP and not on seven ?
-
- Addict
- Posts: 1482
- Joined: Tue Feb 22, 2011 1:16 pm
Re: 2D drawing slow as hell
(Never mind)
Last edited by MachineCode on Wed Sep 21, 2011 2:11 pm, edited 3 times in total.
Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!
PureBasic: Born in 1998 and still going strong to this very day!
Re: 2D drawing slow as hell
You would be better off using bitmapped fonts instead of DrawText if you are using DX/OpenGL.xorc1zt wrote:yes this is faster (2500 fps) but this method is single buffered. just try with DrawText() and you will see the problem.
Best wishes to the PB community. Thank you for the memories. 
Re: 2D drawing slow as hell
MachineCode wrote:Do you really have to ask? It's common knowledge that Vista and 7 are slower and more bloated than XP. You're now experiencing it firsthand.xorc1zt wrote:why decent speed on XP and not on seven ?

pygame 800 fps
freebasic 2400 fps
Python (pygame)
Code: Select all
# Sample Python/Pygame Programs
# Simpson College Computer Science
# http://cs.simpson.edu
import pygame
import random
import os
import platform
# Define some colors
black = ( 0, 0, 0)
white = ( 255, 255, 255)
green = ( 0, 255, 0)
red = ( 255, 0, 0)
pygame.init()
# Set the height and width of the screen
size=[640,480]
screen=pygame.display.set_mode(size)
pygame.display.set_caption("My Game")
#Loop until the user clicks the close button.
done=False
# Used to manage how fast the screen updates
clock=pygame.time.Clock()
#load font, prepare values
font = pygame.font.Font(None, 80)
text = 'Fonty'
size = font.size(text)
fpscounter = 0
fps = 0
oldtime = pygame.time.get_ticks()
newtime = pygame.time.get_ticks()
fg = 250, 240, 230
bg = 5, 5, 5
wincolor = 40, 40, 90
# -------- Main Program Loop -----------
while done==False:
for event in pygame.event.get(): # User did something
if event.type == pygame.QUIT: # If user clicked close
done=True # Flag that we are done so we exit this loop
# Set the screen background
screen.fill(black)
if pygame.time.get_ticks() > oldtime + 1000:
oldtime = pygame.time.get_ticks()
#print(fpscounter)
pygame.display.set_caption(str(fpscounter))
fpscounter = 0
# Limit to 20 frames per second
# clock.tick(20)
for i in range(20):
#rect = pygame.Rect(random.randrange(320), random.randrange(240), random.randrange(320), random.randrange(240))
#screen.fill(random.randrange(0xFFFFFF), rect, special_flags=0)
pygame.draw.rect(screen,random.randrange(0xFFFFFF),
(random.randrange(320),
random.randrange(240),
random.randrange(320),
random.randrange(240)) ,
0)
fpscounter+=1
# Go ahead and update the screen with what we've drawn.
pygame.display.flip()
# Be IDLE friendly. If you forget this line, the program will 'hang'
# on exit.
pygame.quit ()
Code: Select all
#if __FB_LANG__ = "fb"
Using FB
#endif
Randomize , 1
screen 18, 32, 2, GFX_WINDOWED
'ScreenRes 640, 480, 32
dim fps as integer = 0
dim frames as integer = 0
dim oldtime as integer = timer
Function rnd_range (first As Double, last As Double) As Double
Function = Int( Rnd * (last - first) + first )
End Function
screenset 1,0
Do
cls
if timer > oldtime + 1 then
fps = frames
frames = 0
oldtime = timer
end if
for i as integer = 0 to 20
Line (rnd_range(0,320),rnd_range(0,240))-STEP(rnd_range(0,320),rnd_range(0,240)),rnd_range(0,16711680), BF
next i
Draw String (20, 430), Str(fps), RGBA(255,255, 255, 255)
frames += 1
screencopy
Loop Until MultiKey(SC_Q) Or MultiKey(SC_ESCAPE)
Re: 2D drawing slow as hell
It's slow because you're using StartDrawing each iteration of your loop. You will get better results by creating a sprite outside of your loop and then using DisplaySprite instead.
▓▓▓▓▓▒▒▒▒▒░░░░░
-
- Addict
- Posts: 1482
- Joined: Tue Feb 22, 2011 1:16 pm
Re: 2D drawing slow as hell
No, he's not. There's only Box() inside the For/Next loop.Nituvious wrote:It's slow because you're using StartDrawing each iteration of your loop.
Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!
PureBasic: Born in 1998 and still going strong to this very day!
Re: 2D drawing slow as hell
how i can draw random rectangles with a sprite and without box() ? this code has nothing wrong, purebasic just can't do it on windows 7.
Re: 2D drawing slow as hell
Well anyway, this is what I meant.
Code: Select all
#screenwidth = 640
#screenheight = 480
#TOTALBOXES = 100 ; change me to display more boxes
InitSprite()
OpenWindow(0, 0, 0, #screenwidth, #screenheight, "PB Drawing", #PB_Window_ScreenCentered | #PB_Window_MinimizeGadget)
OpenWindowedScreen(WindowID(0), 0, 0, #screenwidth, #screenheight, 0, 0, 0, #PB_Screen_NoSynchronization)
;bufferaddress.i = 0
;StartDrawing(ScreenOutput())
;bufferaddress = DrawingBuffer()
;StopDrawing()
fpscounter.i = 0
timer.i = 0
fps.i = 0
frames.i = 0
totalTime.l = 0
curTime.l = ElapsedMilliseconds()
Dim sprites.l(201)
For i = 0 To 199
Debug i
w = 1+Random(320)
h = 1+Random(240)
sprites.l(i) = CreateSprite(#PB_Any, w,h)
Debug sprites.l(i)
StartDrawing(SpriteOutput(sprites.l(i))) ; -- Random crash here? what the crap?
Box(0,0,w,h, Random($FFFFFF))
StopDrawing()
Next i
Repeat
lastTime = curTime
curTime = ElapsedMilliseconds()
totalTime + (curTime - lastTime)
If( totalTime > 1000 )
totalTime - 1000
fps = frames
frames = 0
EndIf
frames + 1
ClearScreen(RGB(0,0,0))
For x = 0 To #TOTALBOXES
DisplaySprite(sprites.l(Random(#TOTALBOXES)), Random(320),Random(240))
Next
StartDrawing(ScreenOutput())
;For i = 0 To 20
; Box(Random(320), Random(240), Random(320), Random(240), Random($FFFFFF) )
; Next i
DrawText(20,430,Str(fps))
StopDrawing()
FlipBuffers()
Until WindowEvent() = #PB_Event_CloseWindow
Last edited by Nituvious on Thu Sep 22, 2011 10:24 am, edited 1 time in total.
▓▓▓▓▓▒▒▒▒▒░░░░░
Re: 2D drawing slow as hell
Ah, you're right. I forgot all about that! Thank you. I edited my above post.FlixFlax wrote:Hi Nitu. I think it crashes when your w or h = 0.
▓▓▓▓▓▒▒▒▒▒░░░░░
-
- Enthusiast
- Posts: 497
- Joined: Sat Oct 11, 2008 9:07 pm
- Location: Germany, Berlin > member German forum
Re: 2D drawing slow as hell
Hi,
have on my PC Windows XP and Windows 7. For 2d and 3d i make my own Endgine, the mp3d Engine.
For now i have tested it on the Windows XP and Windows 7 partition with PB 4.51, With PB dx9, PB Open Gl and ith PB MP3d as x86 and x64 version
The different between Windows XP and Windows 7 are very big! I don't know the reason but i hope anybody have a idea or solution?
You can load and test the program if you want:
http://www.file-upload.net/download-375 ... t.zip.html
My PC DualCore AMD II 250, 2GByte Ram
x86_______________ Windows XP | Windows7
2D_Testopengl_x86.exe | 194 | 160
2D_Testdx9_x86.exe | 1024 | 66
2D_Testmp3d_x86.exe | 2040 | 184
x64
2D_Testopengl_x64.exe | no | 167
2D_Testdx9_x64.exe | no | 66
2D_Testmp3d_x64.exe | no | 184
Greetings
Michael
have on my PC Windows XP and Windows 7. For 2d and 3d i make my own Endgine, the mp3d Engine.
For now i have tested it on the Windows XP and Windows 7 partition with PB 4.51, With PB dx9, PB Open Gl and ith PB MP3d as x86 and x64 version
The different between Windows XP and Windows 7 are very big! I don't know the reason but i hope anybody have a idea or solution?
You can load and test the program if you want:
http://www.file-upload.net/download-375 ... t.zip.html
My PC DualCore AMD II 250, 2GByte Ram
x86_______________ Windows XP | Windows7
2D_Testopengl_x86.exe | 194 | 160
2D_Testdx9_x86.exe | 1024 | 66
2D_Testmp3d_x86.exe | 2040 | 184
x64
2D_Testopengl_x64.exe | no | 167
2D_Testdx9_x64.exe | no | 66
2D_Testmp3d_x64.exe | no | 184
Greetings
Michael
Working on - MP3D Library - PB 5.73 version ready for download