diff --git a/pkgs/draw-pkgs/draw-doc/scribblings/draw/gl-config-class.scrbl b/pkgs/draw-pkgs/draw-doc/scribblings/draw/gl-config-class.scrbl index c28bc6a7c2..4b15474be5 100644 --- a/pkgs/draw-pkgs/draw-doc/scribblings/draw/gl-config-class.scrbl +++ b/pkgs/draw-pkgs/draw-doc/scribblings/draw/gl-config-class.scrbl @@ -11,9 +11,9 @@ A @racket[gl-config%] object encapsulates configuration information @defconstructor[()]{ -Creates a GL configuration that indicates double buffering, a depth - buffer of size one, no stencil buffer, no accumulation buffer, no - multisampling, and not stereo. +Creates a GL configuration that indicates legacy OpenGL, double +buffering, a depth buffer of size one, no stencil buffer, no +accumulation buffer, no multisampling, and not stereo. } @@ -143,4 +143,20 @@ Adjusts the configuration to request a particular stencil-buffer size, Adjusts the configuration to request stereo or not. -}} +} + +@defmethod[(get-legacy?) + boolean?]{ + +Reports whether to use legacy, "Compatibility" OpenGL or "Core" OpenGL. +@history[#:added "1.2"] +} +@defmethod[(set-legacy? [legacy? any/c]) + void?]{ + +Adjusts the configuration to request legacy or not. +@history[#:added "1.2"] +} + + +} diff --git a/pkgs/draw-pkgs/draw-lib/info.rkt b/pkgs/draw-pkgs/draw-lib/info.rkt index 0742a2072e..cb7a277575 100644 --- a/pkgs/draw-pkgs/draw-lib/info.rkt +++ b/pkgs/draw-pkgs/draw-lib/info.rkt @@ -14,4 +14,4 @@ (define pkg-authors '(mflatt)) -(define version "1.1") +(define version "1.2") diff --git a/pkgs/draw-pkgs/draw-lib/racket/draw/private/contract.rkt b/pkgs/draw-pkgs/draw-lib/racket/draw/private/contract.rkt index 9d09fb422e..27e7859044 100644 --- a/pkgs/draw-pkgs/draw-lib/racket/draw/private/contract.rkt +++ b/pkgs/draw-pkgs/draw-lib/racket/draw/private/contract.rkt @@ -393,7 +393,9 @@ (set-multisample-size (->m (integer-in 0 256) void?)) (set-stencil-size (->m (integer-in 0 256) void?)) (set-stereo (->m any/c void?)) - (set-share-context (->m (or/c (is-a?/c gl-context%) #f) void?)))) + (set-share-context (->m (or/c (is-a?/c gl-context%) #f) void?)) + (get-legacy? (->m boolean?)) + (set-legacy? (->m any/c void?)))) (define bitmap%/c (class/c diff --git a/pkgs/draw-pkgs/draw-lib/racket/draw/private/gl-config.rkt b/pkgs/draw-pkgs/draw-lib/racket/draw/private/gl-config.rkt index 748ec9e1ab..4ddadd3356 100644 --- a/pkgs/draw-pkgs/draw-lib/racket/draw/private/gl-config.rkt +++ b/pkgs/draw-pkgs/draw-lib/racket/draw/private/gl-config.rkt @@ -7,6 +7,10 @@ (defclass gl-config% object% (super-new) + (define legacy? #t) + (define/public (get-legacy?) legacy?) + (define/public (set-legacy? v) (set! legacy? (and v #t))) + (define double-buffered? #t) (define/public (get-double-buffered) double-buffered?) (define/public (set-double-buffered v) (set! double-buffered? (and v #t))) diff --git a/pkgs/gui-pkgs/gui-lib/mred/private/wx/cocoa/canvas.rkt b/pkgs/gui-pkgs/gui-lib/mred/private/wx/cocoa/canvas.rkt index 044ca65c9d..f31c36e5b1 100644 --- a/pkgs/gui-pkgs/gui-lib/mred/private/wx/cocoa/canvas.rkt +++ b/pkgs/gui-pkgs/gui-lib/mred/private/wx/cocoa/canvas.rkt @@ -192,12 +192,22 @@ (define NSOpenGLPFASampleBuffers 55) (define NSOpenGLPFASamples 56) (define NSOpenGLPFAMultisample 59) +(define NSOpenGLPFAOpenGLProfile 99) + +(define NSOpenGLProfileVersionLegacy #x1000) +(define NSOpenGLProfileVersion3_2Core #x3200) (define (gl-config->pixel-format conf) (let ([conf (or conf (new gl-config%))]) (tell (tell NSOpenGLPixelFormat alloc) initWithAttributes: #:type (_list i _int) (append + (if (version-10.7-or-later?) + (list NSOpenGLPFAOpenGLProfile + (if (send conf get-legacy?) + NSOpenGLProfileVersionLegacy + NSOpenGLProfileVersion3_2Core)) + null) (if (send conf get-double-buffered) (list NSOpenGLPFADoubleBuffer) null) (if (send conf get-stereo) (list NSOpenGLPFAStereo) null) (list