OS X, LW 6.0, OpenGL artifacts while resizing
Dear list,
I managed to solve my layout issues by using IB for my UI and dealing directly
with the objc and cocoa interfaces - so far, so good. Now, I have a window with
an NSOpenGLView embedded, which autoresizes while resizing the window.
The real version (done with Xcode) works properly.
When running the LW version (which, to my humble opinion, does not differ)
reveals some artifacts within the GL view, while resizing.
Both versions have the same NIB file.
Does LW intercept window update events ? I am really confused, at the moment...
Here is the view code from the Xcode version:
;----------------------------------------------------
- (id)initWithFrame:(NSRect)frame {
self = [super initWithFrame:frame];
if (self) {
// Initialization code here.
}
return self;
}
- (void)prepareOpenGL
{
glClearColor(0.3, 0.5, 0.0, 1.0);
glViewport(0,0,100,120); /* adjust later */
}
- (void)drawRect:(NSRect)dirtyRect {
// Drawing code here.
glClear(GL_COLOR_BUFFER_BIT);
glSwapAPPLE();
}
;----------------------------------------------------
And my CL version:
;----------------------------------------------------
(objc:define-objc-class gl-view ()
()
(:objc-class-name "GLView")
(:objc-superclass-name "NSOpenGLView"))
(fli:define-foreign-function (gl-swap-apple "glSwapAPPLE")
())
(defun gl-reshape (obj)
(let ((rect (make-array 4)))
(objc:invoke-into rect (objc:objc-object-pointer obj) "frame")
(gl:clear-color 0.3 0.5 0.0 1.0)
(gl:viewport 0 0 (aref rect 2) (aref rect 3))
(gl:matrix-mode :projection)
(gl:load-identity)
(gl:ortho 0.0 (aref rect 2) 0.0 (aref rect 3) 0.0 1.0)))
(objc:define-objc-method ("update" :void)
((this gl-view))
(gl-reshape this))
(objc:define-objc-method ("reshape" :void)
((this gl-view))
(gl-reshape this))
(objc:define-objc-method ("prepareOpenGL" :void)
((this gl-view))
(gl-reshape this))
(objc:define-objc-method ("drawRect:" :void)
((this gl-view)
(rect objc:objc-object-pointer))
(declare (ignore rect))
(gl:clear :color-buffer)
(gl-swap-apple))
;----------------------------------------------------