Lisp HUG Maillist Archive

Activating WebGL on the WebKit framework

I have been exploring the google body browser from one of their labs. 
Really fun and educational. 

http://bodybrowser.googlelabs.com/

It uses WebGL. The instructions are simple for the WebKit browser and simply requires to set a user property using the following command from a Mac OS X terminal. 

defaults write com.apple.Safari WebKitWebGLEnabled -bool YES

I am wondering, how one would enable WebGL using the simple code below?

Bruno

(defun load-webkit ()
  (objc:with-autorelease-pool ()
    (objc:invoke 
     (objc:invoke 
      "NSBundle" "bundleWithPath:"
      (objc:invoke 
       (objc:invoke "NSString" "stringWithString:" "/System/Library/Frameworks/WebKit.framework/")
       "stringByStandardizingPath"))
     "load")))

(defun get-web-view (url)
  (objc:with-autorelease-pool ()
    (let* ((request
            (objc:invoke "NSURLRequest" "requestWithURL:" (objc:invoke "NSURL" "URLWithString:" url)))
           (web-view
            (make-instance 'capi:cocoa-view-pane :view-class "WebView"
                           :init-function
                           #'(lambda (pane view)
                               (declare (ignore pane))
                               (setf view (objc:invoke view "init"))
                               (objc:invoke (objc:invoke view "mainFrame") "loadRequest:" request)
                               view))))
      (capi:contain web-view)
      web-view)))

(load-webkit)

;(get-web-view "http://bodybrowser.googlelabs.com/")
Updated at: 2020-12-10 08:38 UTC