Jump to content
  • Advertisement
Sign in to follow this  
Samith

OpenGL NSOpenGLView in Cocoa

This topic is 2541 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey guys, for my own entertainment I've been attempting to develop some simple OpenGL apps on my Macbook.

I've been following tutorials (this tutorial specifically) and I can't seem to get anything to work. In the "Drawing to an NSOpenGLView class" section, they tell you to drag an NSOpenGLView object onto your window in the IB and set it's class to your MyOpenGLView class. The MyOpenGLView class is a subclass of NSOpenGLView with only the -drawRect function overridden to clear the screen and draw a single triangle. My overridden -drawRect function gets called, but the view remains white, when it should be displaying a triangle on a black background.

If, instead of dragging an NSOpenGLView object onto my window, I drag a "Custom View" object and set its class to MyOpenGLView class (I do not change any code at all), everything works fine.

I'm pretty hesitant to jump on a solution without understanding why, exactly, my solution actually solves anything. Can anyone tell me why it is that the NSOpenGLView object does not work whereas the custom view object does (even without changing any code at all!)? I haven't been able to find any satisfactory answers by googling, though maybe I just don't know what to google.

As always, any help is appreciated!

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!