NSTextField over NSOpenGLView

前端 未结 7 2046
情歌与酒
情歌与酒 2021-02-08 05:42

I have made a window with an NSOpenGLView that I am rendering openGL content into.

I want to add some buttons and text fields to the view: I can add NSTextFields and NSB

7条回答
  •  無奈伤痛
    2021-02-08 05:53

    You have 2 choices:

    1. Create a window just for the text field. Add as a child window of the one hosting the OpenGL view. Major downside is you have to manage positioning it correctly if the Open GL view is moved.

    2. Set up your view hierarchy like so:

      • Layer-backed view
        • Layer-hosting view whose layer contains an OpenGL layer
        • Text field

提交回复
热议问题