YESSSSSSS, I found the problem...well...it's not really MY problem, but something you should definitely figure out!
OpenGL!
Using the glmax2d drivers makes some machines (laptops with Mobile Intel - Extreme Chipsets for example- immune to a vertical blank request...
Here's the proof:
SuperStrict
'switch GL with d3d7 drivers to recognize the problem!
Framework brl.GLMax2D
'Framework brl.d3d7Max2D
Import brl.StandardIO
Import maxgui.win32maxguiex
Import brl.eventqueue
'--------------------------------------------------------------'
'"Got Balls?" '
'A little benchmark routine for smoothness and consistency of '
'frames per second (fps) on any system... (www.taron.de) '
'--------------------------------------------------------------'
'(feel free to use my balls any time you like!)
'------------------------------- set graphics
'Graphics(800,600,0,60)
Global window:Tgadget = CreateWindow("BM spriteballs",0,0,800,600,Null,WINDOW_TITLEBAR|WINDOW_CENTER|WINDOW_CLIENTCOORDS)
Global canvas:Tgadget = CreateCanvas(0,0,800,600,window)
'SetGraphicsDriver GLMax2DDriver()
'SetGraphicsDriver D3D7Max2DDriver()
SetGraphics CanvasGraphics ( Canvas )
AutoMidHandle(1)
'------------------------------- create image of lit ball
Local size:Int =64
Local half:Int = size Shr 1
Global blob:TImage = CreateImage(size,size,1,FILTEREDIMAGE)
Local bpix:TPixmap = LockImage(blob,0)
Local normal:vec = vec.Create()
Local light:vec = vec.Create()
light.x = 0.0;light.y = 0.5;light.z = +0.4;light.normalize3d()
Local rgb:Int
For Local y:Byte = 0 Until size
For Local x:Byte = 0 Until size
normal.x = x-half
normal.y = y-half
Local alpha:Int = $ff-(Int(normal.x*normal.x+normal.y*normal.y)Shr 2)
If alpha<0 Then alpha = 0 Else alpha:*8
If alpha>255 Then alpha = 255
normal.x :/half
normal.y :/half
normal.z = (1.0-(normal.x*normal.x+normal.y*normal.y))^0.5
normal.normalize3d()
rgb = normal.dot3d(light)*$ff
If rgb <0 Then rgb = 0
rgb = rgb | (rgb Shl 8) | (rgb Shl $10)
WritePixel(bpix,x,y,(alpha Shl $18)|rgb)
Next
Next
UnlockImage(blob,0)
'------------------------------- create image of funny highlight
Global spec:TImage = CreateImage(16,16,1,FILTEREDIMAGE)
bpix = LockImage(spec,0)
For Local y:Byte = 0 Until 16
For Local x:Byte = 0 Until 16
normal.x = x-8
normal.y = y-8
Local alpha:Int = $ff-(Int(normal.x*normal.x+normal.y*normal.y)Shl 2)
If alpha<0 Then alpha = 0
WritePixel(bpix,x,y,(alpha Shl $18)|$ffffff)
Next
Next
UnlockImage(spec,0)
bpix = Null
GCCollect()
'------------------------------- LITTLE (2d/3d) VECTOR TYPE
Type vec
Field x:Float
Field y:Float
Field z:Float
Field length:Float
Field dot:Float
Method dot2d:Float(v:vec)
dot = x*v.x + y*v.y
Return dot
End Method
Method dot3d:Float(v:vec)
dot = x*v.x+ y*v.y + z*v.z
Return dot
End Method
Method normalize2d:Float()
length = x*x+y*y
If length
length = Sqr(length)
x:/length
y:/length
End If
Return length
End Method
Method normalize3d()
length = x*x+y*y+z*z
If length
length = Sqr(length)
x:/length
y:/length
z:/length
End If
End Method
Function Create:vec()
Return New vec
End Function
End Type
'------------------------------- SPRITE TYPE
Type sprite
Global splist:TList = CreateList()
Field pos:vec
Field loc:vec
Field col:vec
Field rot:Float
Method draw()
pos.x:+ loc.x
pos.y:+loc.y
Local dir:vec = vec.Create()
dir.x = center.x-pos.x
dir.y = center.y-pos.y
Local dist:Float = dir.normalize2d()
rot = ACos(dir.y)
If dir.x>0 Then rot = ACos(-dir.y)+180
SetRotation rot
dir.length= $ff - dir.length/8
Local fade:Float = dir.length/$ff
SetColor col.x*dir.length,col.y*dir.length*fade,col.z*dir.length*fade^2
SetBlend ALPHABLEND
SetScale fade,fade
DrawImage(blob,0.5*pos.x,0.5*pos.y,0)
SetColor $ff,$ff,$ff
SetBlend LIGHTBLEND
SetAlpha 0.4*dir.length/$ff
SetScale fade,fade*(1.0-(dist/800))
DrawImage(spec,0.5*pos.x+dir.x*dist*0.025*fade,0.5*pos.y+dir.y*dist*0.025*fade,0)
SetScale 1,1
SetAlpha 1.0
End Method
Function Create:sprite(l:vec)
Local s:sprite = New sprite
s.pos = vec.Create()
s.loc = vec.Create()
s.loc.x = l.x
s.loc.y = l.y
s.rot = 0
s.col = vec.Create()
s.col.x = (l.x *0.93) Mod 1
s.col.y = (l.y *0.92) Mod 1
s.col.z = (l.y+l.x *0.91) Mod 1
ListAddLast splist,s
Return s
EndFunction
EndType
'------------------------------- create & distribute sprites
Const amount_of_sprites:Int = 100
Local rep:Int = Sqr(amount_of_sprites)
Local location:vec = vec.Create()
For Local y:Int = 0 Until rep
For Local x:Int = 0 Until rep
location.x=32+x*32
location.y=32+y*32
sprite.Create(location)
Next
Next
Function MyHook:Object(iId:Int,Data:Object,Context:Object)
Local Event:TEvent=TEvent(Data)
If event=Null Return Null
Return Data
EndFunction
AddHook EmitEventHook , MyHook
Global onoff:String[]=["off","on"]
Global center:vec = vec.Create()
Global sp:sprite
Global vb:Byte = 1
Global fps:Int = 0
Global frames:Int = 0
Global dt:Int = 0
Global t:Int = MilliSecs()
Global acc:Int = 0
Repeat
balls()
PollEvent()
If EventID() = EVENT_WINDOWCLOSE Then End
If EventID() = EVENT_MOUSEMOVE
center.x=EventX()*2'400+Sin(acc)*200
center.y=EventY()*2'300+Cos(acc)*200
End If
If EventID() = EVENT_KEYDOWN
If EventData() = KEY_ESCAPE Then End
If EventData() = KEY_V Then vb:~1
End If
Forever
'------------------------------- main loop
Function balls()
dt:+ MilliSecs()-t
t = MilliSecs()
frames:+1
If dt>1000
fps = frames
frames = 0
dt = 0
End If
SetBlend ALPHABLEND
SetAlpha 0.5
SetColor 0,0,0
DrawRect (0,0,800,600)
SetAlpha 1.0
Local i:Int = 0
For sp = EachIn sp.splist
sp.pos.x:*Sin(acc+i*13)*Cos(i)
sp.pos.y:*Cos(acc+i*13)*Sin(acc)
sp.draw()
i:+1
Next
acc:+2
SetColor $ff,$ff,$ff
SetRotation 0
DrawText "FPS: "+fps,530,500
SetAlpha 0.2
DrawText "'v' toggles vertical blank ["+onoff[vb]+"]",530,520
Flip vb
EndFunction