NSView OpenGL Oddity

I encountered this strange behavior that I've searched the Internet for days without finding a good answer.

Here is my OpenGL embedding scenario:

I have this NSView, say viewB, which is set to render an OpenGL scene. [NSOpenGLContext setView: viewB].

This View is put into another view, say viewA. [viewA addSubview: viewB].

when viewB is well within the bounds of viewA. The openGL scene is rendered correctly.

when viewB is partially outside the top or the right borders of viewA, the openGL scene is also rendered correctly with correct clipping of viewB by viewA.

However, when viewB is partially outside the bottom or the left borders of viewA, I see a strange offset of the OpenGL scene or viewport that put the scene origin within the bounds of viewA. ( as opposed to the expected behavior where scene origin is outside viewA and only the right/top half of the scene is visible.)

Has anyone seen this before? is it something simple that I've overlooked.

Appreciate any help. I am a newbie to both cocoa and opengl programming.