Try this with GLFW target, ziggy:
Strict
Import mojo
Extern
'Function glfwInit:Int()
Function glfwOpenWindowHint:Void(target:Int, hint:Int)
Function glfwSetWindowSize:Void(width:Int, height:Int)
Function glfwSetWindowPos:Void(x:Int, y:Int)
'Function glfwOpenWindow:Int(width:Int, height:Int, redbits:Int, greenbits:Int, bluebits:Int, alphabits:Int, depthbits:Int, stencilbits:Int, mode:Int )
Public
Const GL_TRUE:Int = 1
Const GL_FALSE:Int = 0
Const GLFW_STEREO:Int = $00020011
Const GLFW_WINDOW_NO_RESIZE:Int = $00020012
Const GLFW_FSAA_SAMPLES:Int = $00020013
Const GLFW_FULLSCREEN:Int = $00010002
Function RotateAt:Void(x:Float, y:Float, angle:Float)
Translate(x, y)
Rotate(angle)
Translate(-x, -y)
End
Class Program Extends App
Field angle:Float = 0
Method OnCreate:Int()
SetUpdateRate(60)
glfwSetWindowPos(0,0) ' set window position
glfwSetWindowSize(1280,1024) ' resize window
Return 0
End
Method OnRender:Int()
Local dw:Int = DeviceWidth()
Local dh:Int = DeviceHeight()
Cls(128,128,128)
SetColor(0,0,0)
For Local i:Int = 0 To dw Step 20
DrawLine(0,0,i,dh)
Next
DrawCircle(dw-100,100,50)
'For Local i:Int = 0 To 200 Step 3
' RotateAt(dw*0.5,dh*0.5,5)
' SetAlpha(255-i)
' DrawRect(dw*0.5-200+i,dh*0.5-200+i,400-i*2,400-i*2)
'Next
RotateAt(dw*0.5,dh*0.5,angle)
angle += 0.1
SetColor(0,0,255)
DrawRect(dw*0.5-100,dh*0.5-100,200,200)
Return 0
End
Method OnUpdate:Int()
If KeyHit(KEY_ESCAPE)
EndApp()
Endif
Return 0
End
End
Function Main:Int()
glfwOpenWindowHint(GLFW_FSAA_SAMPLES, 8) ' AntiAliasing samples: 0 = disable AA
New Program
Return 0
End Tested on Mac OS X and Windows with Monkey X 76d, I get nice antialiased lines, circle, rect. Try with values 4, 8, 16 for AA. 0 to disable (default).
|