OpenGL Setup - NIB or Code?
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.
Code, anytime.
I prefer the flexibility, especially if you want to go fullscreen.
I prefer the flexibility, especially if you want to go fullscreen.
nib is easier, code is more flexible (aka fullscreen).
your choice
your choice
Code methinks, is the better way. The nib approach is quick and dirty, and pretty unreliable and actually a pain to setup.
DoG Wrote:The nib approach is quick and dirty, and pretty unreliable ...
unreliable how?
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.
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.
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.
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.
Sohta Wrote:it?
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
I think Sohta is refering to Skyhawk's post. He uses code.
nib
(mandatory aditional characters)
(mandatory aditional characters)
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
There should be an option for "Depends upon the circumstances"
That'd get my vote
That'd get my vote
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| OpenGL Pixel Buffer Object setup issue | dotbianry | 2 | 1,079 |
Jan 6, 2013 11:03 AM Last Post: dotbianry |
|
| OpenGL ES2 matrix setup (humbly crawling back) | Fenris | 2 | 5,225 |
Aug 31, 2011 06:47 AM Last Post: Fenris |
|
| bug in OpenGL setup for NSOpenGL subclass (I think) | backslash | 2 | 3,259 |
Jul 18, 2007 01:10 PM Last Post: backslash |
|
| xCode/SDL Setup | hammonjj | 2 | 4,293 |
Mar 2, 2007 06:37 AM Last Post: hammonjj |
|
| NEED HELP! OpenGL code for my exam doesn't work | mr02077 | 2 | 2,400 |
Feb 9, 2007 05:44 PM Last Post: stevejohnson |
|


