Changeset 6166


Ignore:
Timestamp:
Apr 8, 2007, 1:38:34 AM (12 years ago)
Author:
gb
Message:

Change some comments; as elsewhere, we're reserving space for 4 SINGLE-floats.
Some syntax changes: use #/ vice SEND, etc.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/objc-gf/ccl/examples/rubix/opengl.lisp

    r844 r6166  
    7878       (unwind-protect
    7979           (let ((*opengl-context* ,contextsym))
    80              (send ,contextsym 'make-current-context)
     80             (#/makeCurrentContext ,contextsym)
    8181             ,@body)
    8282         ;; the following resets the current context to what it was
    8383         ;; previously as far as the special bindings are concerned
    8484         (if *opengl-context*
    85              (send *opengl-context* 'make-current-context)
    86            (send (@class ns-opengl-context) 'clear-current-context))))))
     85           (#/makeCurrentContext *opengl-context*)
     86           (#/clearCurrentConext ns:ns-opengl-context))))))
    8787
    8888(defun new-pixel-format (&rest attributes)
     
    9090  ;; small ints), make an array (character array?), and create and
    9191  ;; return an NSOpenGLPixelFormat
    92   (let* ((attribute-size (ccl::foreign-size :<NSO>pen<GLP>ixel<F>ormat<A>ttribute :bytes)))
    93     (ccl::%stack-block ((objc-attributes (* attribute-size (1+ (length attributes)))))
    94       (loop for i from 0 to (* (1- (length attributes)) attribute-size) by attribute-size
     92  (let* ((attribute-size (ccl::foreign-size :<NSO>pen<GLP>ixel<F>ormat<A>ttribute :bytes))
     93         (nattributes (length attributes)))
     94    (ccl::%stack-block ((objc-attributes (* attribute-size (1+ nattributes))))
     95      (loop for i from 0 to nattributes
    9596            for attribute in attributes do
    96             (setf (%get-long objc-attributes i) attribute) ; <- autocoerced?
    97             finally (let ((lastpos (* (length attributes) attribute-size)))
    98                       (setf (%get-long objc-attributes lastpos) 0))) ; <- objc nil = null ptr
    99       (let* ((pixelformat (ccl::send (ccl::send (ccl::@class ns-opengl-pixel-format) 'alloc)
    100                                      :init-with-attributes objc-attributes)))
    101         pixelformat))))
     97            (setf (ccl:paref objc-attributes (:* :<NSO>pen<GLP>ixel<F>ormat<A>ttribute) i) attribute) ; <- autocoerced?
     98            finally (setf (ccl:paref objc-attributes (:* :<NSO>pen<GLP>ixel<F>ormat<A>ttribute) nattributes) 0)) ; <- objc nil = null ptr
     99      (make-instance ns:ns-opengl-pixel-format :with-attributes objc-attributes))))
    102100
    103101#|
    104102(setf pf (opengl:new-pixel-format #$NSOpenGLPFADoubleBuffer #$NSOpenGLPFADepthSize 32))
    105103(%stack-block ((a-long 4))
    106   (send pf :get-values a-long :for-attribute #$NSOpenGLPFADepthSize :for-virtual-screen 0)
     104  (#/getValues:forAttribute:forVirtualScreen: pf a-long #$NSOpenGLPFADepthSize 0)
    107105  (%get-long a-long))
    108106|#
Note: See TracChangeset for help on using the changeset viewer.