NSTextField over NSOpenGLView

前端 未结 7 1950
情歌与酒
情歌与酒 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:47

    The text can be rendered into a texture -- I just used this for a project, did a lot of looking for sample code, and ultimately found Apple's GLString demo code, which was an absolute trove of how-to:

    http://developer.apple.com/library/mac/#samplecode/CocoaGL/Listings/GLString_m.html

    I haven't tried adding buttons, but you can, of course, draw your own and comparing the positions of click events with those of your buttons...

提交回复
热议问题