OpenGL Setup - NIB or Code?

Member
Posts: 64
Joined: 2005.06
Post: #1
So, do you setup your OpenGL instance in the NIB, or purely in code? Apple uses the NIB, most people here seem to do it in purely in code.
Quote this message in a reply
Member
Posts: 72
Joined: 2006.10
Post: #2
Code, anytime.

I prefer the flexibility, especially if you want to go fullscreen.

- Sohta
Quote this message in a reply
Moderator
Posts: 916
Joined: 2002.10
Post: #3
nib is easier, code is more flexible (aka fullscreen).


your choice
Quote this message in a reply
DoG
Moderator
Posts: 869
Joined: 2003.01
Post: #4
Code methinks, is the better way. The nib approach is quick and dirty, and pretty unreliable and actually a pain to setup.
Quote this message in a reply
Member
Posts: 304
Joined: 2002.04
Post: #5
DoG Wrote:The nib approach is quick and dirty, and pretty unreliable ...

unreliable how?
Quote this message in a reply
Moderator
Posts: 916
Joined: 2002.10
Post: #6
DoG Wrote:Code methinks, is the better way. The nib approach is quick and dirty, and pretty unreliable and actually a pain to setup.
it has worked perfectly for me everytime.
Quote this message in a reply
Sage
Posts: 1,232
Joined: 2002.10
Post: #7
Apple uses the nib? No, Apple does it three ways:

1: NSOpenGLView subclass set up in the nib (AccumSample)
2: Custom class instantiated in the nib but setup in code (Cocoa OpenGL)
3: Everything instantiated and set up in code (BoingX)

I didn't count every single example but if you did I bet you'd find 2 is the most common.

I usually use 2, since it allows hooking up outlets to the view. Sometimes 3, for games with no UI other than the view. 1 is useless for everything except the most basic examples, since you can't configure all of the pixel format attributes through the NSOpenGLView inspector (multisample, fullscreen...)

Anyway, since you have to set up regular OpenGL state in code no matter what, it's hardly any more work at all to set up the pixel format, GL context, and window if you want, in code.
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #8
I always go for a nibbed NSOpenGLView subclass.
Quote this message in a reply
Member
Posts: 196
Joined: 2002.04
Post: #9
I use nib always. I also use an NSWindow for fullscreen since all of the Core Graphics pixel format code I've looked at seems to create flickering for some reason.
Quote this message in a reply
Member
Posts: 72
Joined: 2006.10
Post: #10
it? Blink

do you mean using nibs or code?

- Sohta
Quote this message in a reply
Member
Posts: 749
Joined: 2003.01
Post: #11
Sohta Wrote:it? Blink

do you mean using nibs or code?

what are you talking about?

©h€ck øut µy stuƒƒ åt ragdollsoft.com
New game in development Rubber Ninjas - Mac Games Downloads
Quote this message in a reply
Member
Posts: 196
Joined: 2002.04
Post: #12
I think Sohta is refering to Skyhawk's post. He uses code.
Quote this message in a reply
Moderator
Posts: 916
Joined: 2002.10
Post: #13
nib
(mandatory aditional characters)
Quote this message in a reply
Member
Posts: 469
Joined: 2002.10
Post: #14
The only thing I don't like about code is the weird glFlush()/flushContext issues. Nib'd subclasses generally behave better with the Quartz Compositor.

---Kelvin--
15.4" MacBook Pro revA
1.83GHz/2GB/250GB
Quote this message in a reply
Member
Posts: 104
Joined: 2002.04
Post: #15
There should be an option for "Depends upon the circumstances"

That'd get my vote
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  OpenGL Pixel Buffer Object setup issue dotbianry 2 3,158 Jan 6, 2013 11:03 AM
Last Post: dotbianry
  OpenGL ES2 matrix setup (humbly crawling back) Fenris 2 6,546 Aug 31, 2011 06:47 AM
Last Post: Fenris
  bug in OpenGL setup for NSOpenGL subclass (I think) backslash 2 3,745 Jul 18, 2007 01:10 PM
Last Post: backslash
  xCode/SDL Setup hammonjj 2 4,763 Mar 2, 2007 06:37 AM
Last Post: hammonjj
  NEED HELP! OpenGL code for my exam doesn't work mr02077 2 2,806 Feb 9, 2007 05:44 PM
Last Post: stevejohnson