sync gl refresh with monitor refresh in macosx
parent
30bb157b31
commit
817019678d
|
@ -74,3 +74,17 @@ PRIVATE>
|
||||||
-> locationInWindow f -> convertPoint:fromView:
|
-> locationInWindow f -> convertPoint:fromView:
|
||||||
dup NSPoint-x swap NSPoint-y
|
dup NSPoint-x swap NSPoint-y
|
||||||
r> -> frame NSRect-h swap - 2array ;
|
r> -> frame NSRect-h swap - 2array ;
|
||||||
|
|
||||||
|
USE: opengl.gl
|
||||||
|
USE: alien.syntax
|
||||||
|
|
||||||
|
: NSOpenGLCPSwapInterval 222 ;
|
||||||
|
|
||||||
|
LIBRARY: OpenGL
|
||||||
|
|
||||||
|
TYPEDEF: int CGLError
|
||||||
|
TYPEDEF: void* CGLContextObj
|
||||||
|
TYPEDEF: int CGLContextParameter
|
||||||
|
|
||||||
|
FUNCTION: CGLError CGLSetParameter ( CGLContextObj ctx, CGLContextParameter pname, GLint* params ) ;
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
! Copyright (C) 2006, 2008 Slava Pestov
|
! Copyright (C) 2006, 2008 Slava Pestov
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: alien arrays assocs cocoa kernel math cocoa.messages
|
USING: alien alien.c-types arrays assocs cocoa kernel math cocoa.messages
|
||||||
cocoa.subclassing cocoa.classes cocoa.views cocoa.application
|
cocoa.subclassing cocoa.classes cocoa.views cocoa.application
|
||||||
cocoa.pasteboard cocoa.types cocoa.windows sequences ui
|
cocoa.pasteboard cocoa.types cocoa.windows sequences ui ui.gadgets
|
||||||
ui.gadgets ui.gadgets.worlds ui.gestures core-foundation
|
ui.gadgets.worlds ui.gestures core-foundation threads combinators ;
|
||||||
threads combinators ;
|
|
||||||
IN: ui.cocoa.views
|
IN: ui.cocoa.views
|
||||||
|
|
||||||
: send-mouse-moved ( view event -- )
|
: send-mouse-moved ( view event -- )
|
||||||
|
@ -360,8 +359,14 @@ CLASS: {
|
||||||
]
|
]
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
: sync-refresh-to-screen ( GLView -- )
|
||||||
|
-> openGLContext -> CGLContextObj NSOpenGLCPSwapInterval 1 <int>
|
||||||
|
CGLSetParameter drop ;
|
||||||
|
|
||||||
: <FactorView> ( world -- view )
|
: <FactorView> ( world -- view )
|
||||||
FactorView over rect-dim <GLView> [ register-window ] keep ;
|
FactorView over rect-dim <GLView>
|
||||||
|
[ sync-refresh-to-screen ] keep
|
||||||
|
[ register-window ] keep ;
|
||||||
|
|
||||||
CLASS: {
|
CLASS: {
|
||||||
{ +superclass+ "NSObject" }
|
{ +superclass+ "NSObject" }
|
||||||
|
|
Loading…
Reference in New Issue