Problem with NSOpenGLView and glViewport

I have a strange behaviour with the NSOpenGLView reshape method. Maybe someone can help me.


As you can see I draw a simple rectangle without a matrix directly in the -1..1, -1..1 coordinate system. The fragment shader only sets the color white and the vertex shader the position without any modifications.

When I resize the window I adjust the viewport in the reshape method as you can see below. In the second screenshot you see that the viewport changes are now succesfull but there is a clipping at the right edge even clipping is not enabled. It becomes more strange when I resize the window in the vertical direction (3rd screenshot). Here the triangle changes its size in the correct way but the whole viewport seems to shift in the vertical position and does not start at window coordinate (0,0) anymore.


    override func reshape() {
        glViewport(0, 0, GLsizei(frame.size.width), GLsizei(frame.size.height))
    }


The NSOpenGLView has been positioned in the window with edge constraints. The frame dimension changes are correct. Also clearing the background works for the whole screen area (black background).


http://i.imgur.com/cG3Cljk.png

http://i.imgur.com/ljUOy2c.png

http://i.imgur.com/MKyak53.png

Problem with NSOpenGLView and glViewport
 
 
Q