Problems with rendering using NSOpenGLView

Moderator
Posts: 373
Joined: 2006.08
Post: #1
I've been trying to create "pong", but I'm having trouble displaying it Annoyed

The source code is raher long, but I'd be glad if you could perhaps help me out with it Smile It's at http://www.ghettointeractions.com/mac/ if you want to download it (in zipped version) or I can post it hear if you fear a virus Wink

Thanks,
-wyrmmage
Quote this message in a reply
Member
Posts: 87
Joined: 2006.08
Post: #2
It crashes for me immediatly on launch. At first glance, you've added a bunch of code to main().

With Cocoa, you really shouldn't do that. You should instantiate your game controller as part of the NIB.

For something as simple as Pong, I would actually suggest you forget about OpenGL, and try to follow the Cocoa examples and tutorials, and draw it all in 2D. Once that works, you can re-implement the rendering in OpenGL.

Cocoa and OpenGL are two very big subjects, and attempting to begin them both at the same time will lead to unnecessary frustration.
Quote this message in a reply
Sage
Posts: 1,403
Joined: 2005.07
Post: #3
Hahaha a virus! LOL

you dont want to be editing main.m, ever.
All your key handling should be in Lesson02View.

Sir, e^iπ + 1 = 0, hence God exists; reply!
Quote this message in a reply
Moderator
Posts: 373
Joined: 2006.08
Post: #4
hmmm....not quite sure how to instantiate using NIBS; I really haven't had much experience with this sort of thing. I'd prefer to use OpenGL because I one day (perhaps in three or four months) I hope to make something 3D, and I'd rather just go ahead and get the problems with using Cocoa and OpenGL over with.
How am I going to handle my key presses in Lesson02View? Just copy that part of the code from Lesson02Controller?
In the meantime I'll be reading up on NIBS Wink
Thanks for the help,
-wyrmmage
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  NSOpenGLView subclass not overriding super? mahalis 6 5,544 Sep 12, 2006 07:46 PM
Last Post: OneSadCookie
  drawRect in NSOpenGLView help fakeOne 3 4,564 Sep 3, 2006 09:04 AM
Last Post: Xenos
  Full-screen with NSOpenGLView not working forseti 9 5,589 Jun 24, 2002 01:53 AM
Last Post: forseti