cocoa: fix some GL problems

This commit is contained in:
Matthew Flatt 2011-11-02 19:10:13 -06:00
parent a495c9f349
commit 4bbb2d41aa
2 changed files with 16 additions and 4 deletions

View File

@ -280,10 +280,13 @@
(queue-window-refresh-event this thunk))
(define/public (paint-or-queue-paint)
(or (do-canvas-backing-flush #f)
(begin
(queue-paint)
#f)))
(cond
[is-gl? (do-canvas-backing-flush #f)
(queue-paint)
#t]
[(do-canvas-backing-flush #f) #t]
[else (queue-paint)
#f]))
(define/public (do-canvas-backing-flush ctx)
(do-backing-flush this dc (tell NSGraphicsContext currentContext)

View File

@ -20,6 +20,7 @@
do-backing-flush))
(import-class NSOpenGLContext)
(define NSOpenGLCPSwapInterval 222)
(define dc%
(class backing-dc%
@ -44,6 +45,14 @@
(define/override (do-swap-buffers)
(tellv gl-ctx flushBuffer))
(super-new)))])
;; Disable screen sync for GL flushBuffer; otherwise,
;; flushBuffer can take around 10 msec depending on the timing
;; of event polling, and that can be bad for examples like gears.
;; Maybe whether to sync with the screen should be a configuration
;; option, but I can't tell the difference on my screen.
(tellv gl-ctx setValues:
#:type (_ptr i _long) 0
forParameter: #:type _int NSOpenGLCPSwapInterval)
(set! gl g)
g)))))