0

假设我正在编写某种 2D cad 程序,并且我希望能够放大和滚动我的文档。但是,我还希望完全控制我的文档的绘制方式,并且我需要一个用于绘制的 OpenGL 上下文。我该怎么做呢?我应该继承 NSScrollView 并做一些我无法弄清楚的事情吗?我应该继承 NSOpenGLView 并添加一对 NSScrollers 并弄清楚如何正确绘制它们吗?制作 NSScrollers 并以一种看起来不错的方式绘制它们看起来很自然,但 NSScrollViews 似乎想要拥有你可能正在滚动的所有内容,而不是让我控制滚动条旋钮的大小和其他类似的东西。我完全满足于以像素或类似的形式给出文档大小,对我来说最重要的是当我绘制到 (0,

4

1 回答 1

1

Should I subclass NSOpenGLView and add a pair of NSScrollers

Yes, since scrolling a OpenGL view doesn't make sense. You want to adjust the viewing volume (i.e. the parameters defining the projection matrix), rather than moving your viewport around. And that only works if you have manual control over the scroll bars.

于 2013-06-03T11:21:37.780 回答