A couple of OpenGL questions

Moderator
Posts: 624
Joined: 2007.09
Post: #1
I think I am ready to begin learning OpenGL, but have a couple of questions.

1. Should I do everything in code, as with the NeHe tutorials, or should I use the NSOpenGLView/NSView?

2. Should I use the Nehe tutorials, or are there better opengl tutorials specifically for Mac?

3. Should I start out in 2D? If so, can anyone point me to some good Mac tutorials?

4. Should I use Cocoa at all?

I went through the Golden Triangle tutorial on the Apple website, and as exciting as it was, I didn't see any follow-ups to it.Annoyed

Any help/advice/other random things would be greatly appreciated.

- Lincoln Green
http://www.binkworks.com/
Quote this message in a reply
Member
Posts: 24
Joined: 2008.01
Post: #2
1. Should I do everything in code, as with the NeHe tutorials, or should I use the NSOpenGLView/NSView?

NSOpenGLView requires a little more setup than GLUT, but I think it's worth it and it will help ease you into Cocoa too. All the OpenGL commands are the same.

2. Should I use the Nehe tutorials, or are there better opengl tutorials specifically for Mac?

NeHe's tuts are probably the best there is. Most, if not all of it, is applicable to the Mac. Just watch out for 'DWORDS' etc as a lot of 'OpenGL' code out there assumes you're using Windows.

3. Should I start out in 2D? If so, can anyone point me to some good Mac tutorials?

In OpenGL, the leap from 2D to 3D isn't really that great. I guess it all depends what you want to do. The book 'Computer Graphics with OpenGL' by Hill, although hefty is excellent, as is the ARB's Red Book which everyone should read. If you can find it, I also found 'OpenGL Primer' a good read.

4. Should I use Cocoa at all?

You question should be, 'Why SHOULDN'T I use Cocoa?' Wink
Quote this message in a reply
Moderator
Posts: 624
Joined: 2007.09
Post: #3
Danny77uk Wrote:NSOpenGLView requires a little more setup than GLUT, but I think it's worth it and it will help ease you into Cocoa too. All the OpenGL commands are the same.

NeHe's tuts are probably the best there is. Most, if not all of it, is applicable to the Mac. Just watch out for 'DWORDS' etc as a lot of 'OpenGL' code out there assumes you're using Windows.

In OpenGL, the leap from 2D to 3D isn't really that great. I guess it all depends what you want to do. The book 'Computer Graphics with OpenGL' by Hill, although hefty is excellent, as is the ARB's Red Book which everyone should read. If you can find it, I also found 'OpenGL Primer' a good read.

You question should be, 'Why SHOULDN'T I use Cocoa?' Wink

OK. Why shouldn't I use Cocoa.

I am currently broke; I was compelled to quit my paper route* right after I bought my Mac Mini, so I have no money(Which tends to be a problem). Also, based on other posts in this forum, it's cheaper to buy Unity than buy books on OpenGL. As much as I dislike learning this way, it seems to be the only way right now…Sad Which brings up another question; should I even bother learning OpenGL, or just develop non games until I raise enough money to buy Unity? Anyway, thanks for the advice. I'll try the NeHe tutorials.

*Paper routes, while having very low pay and being very hard to do(especially in the winter), were the alternative to nothing.

- Lincoln Green
http://www.binkworks.com/
Quote this message in a reply
Apprentice
Posts: 6
Joined: 2008.03
Post: #4
Learn OpenGL while you raise money for an engine. That is something similar to what I did. You never know when you will want a source level change on an engine, the ability to make that change is rewarding. :-)
Quote this message in a reply
Moderator
Posts: 624
Joined: 2007.09
Post: #5
That's what I figured.Smile

- Lincoln Green
http://www.binkworks.com/
Quote this message in a reply
Member
Posts: 715
Joined: 2003.04
Post: #6
Or you could just learn some Lua and help out with iGame3D, and pay nothing.
Maybe by the time you learn OpenGL you could add something cool to the engine like bloom or 2D
features I can never convince Tobi to mess with.
Quote this message in a reply
Moderator
Posts: 3,579
Joined: 2003.06
Post: #7
Hairball183 Wrote:OK. Why shouldn't I use Cocoa.

Cocoa works great for this kind of stuff. Be forewarned that it does take a little setup. I like to use NSOpenGLView as a custom class to the custom NSView in IB. Do not use the premade OpenGLView in IB, subclass your own instead. Like I said, I like to subclass from NSOpenGLView, but there are others here who prefer to subclass all the way from NSView. It's your choice really.

Unity is still the best way to go for 3D IMHO, but there is nothing wrong with having a go at OpenGL on your own -- especially for 2D.

I think 2D is arguably easier to start with, although I wouldn't shy away from learning 3D stuff along the way, since the path to learning OpenGL is littered with it. I would plan on making a 2D game first though.

I would also start with GLUT instead of fighting with learning NSOpenGLView and all the other little details you are likely to wrestle with at first. Not that it's terribly hard to use Cocoa, but GLUT really does dump you in the thick of things right away with just a few lines of code. Look for OSC's tutorial on it -- I don't have a link handy, sorry.

Once you can do a little damage with GLUT, then it would be a good idea to step up to using Cocoa for your windowing code.
Quote this message in a reply
Moderator
Posts: 373
Joined: 2006.08
Post: #8

Worlds at War (Current Project) - http://www.awkward-games.com/forum/
Quote this message in a reply
Member
Posts: 312
Joined: 2006.10
Post: #9
You can definitely learn OpenGL without buying any books! The Red Book should be more than sufficient to start.

If you can pull-off buying Unity I'd definitely do that! I love using Unity, it's a joy Smile
Quote this message in a reply
Moderator
Posts: 624
Joined: 2007.09
Post: #10
The red book is free? Sweet! I think I Unity will be my next big purchase.

- Lincoln Green
http://www.binkworks.com/
Quote this message in a reply
Moderator
Posts: 3,579
Joined: 2003.06
Post: #11
Hairball183 Wrote:The red book is free?

I don't think it's actually free but there was/(maybe still is) a pdf of the third? edition floating around some time ago. That should cover OpenGL 1.2, which is all you really need to know right now anyway. 2.0 might be nice but things will be changing with OpenGL soon anyway, so 1.2 will easily suffice. You can search the forums to maybe find a link to it, but I don't know if it was taken down or not. Maybe Google it. Nobody seems to really know what the legality of it was/is.

Outside of the Red Book, there are lots of sites that have API documentation for OpenGL. There also exist real places called libraries. Well at least they existed when I was a kid. We used to walk/bike to them and borrow books for free! Don't know if they're still around, but it might be worth a look.
Quote this message in a reply
Member
Posts: 715
Joined: 2003.04
Post: #12
If Dixon California is where you're at then You can get these books from the local library

I suggest "Strawberry Shortcake music for dress up days", it really help me learn openGL. LOL
Quote this message in a reply
Member
Posts: 24
Joined: 2008.01
Post: #13
AnotherJake Wrote:Do not use the premade OpenGLView in IB, subclass your own instead. Like I said, I like to subclass from NSOpenGLView, but there are others here who prefer to subclass all the way from NSView. It's your choice really.

What's wrong with the premade view in IB?
Quote this message in a reply
Moderator
Posts: 624
Joined: 2007.09
Post: #14
AnotherJake Wrote:I don't think it's actually free but there was/(maybe still is) a pdf of the third? edition floating around some time ago. That should cover OpenGL 1.2, which is all you really need to know right now anyway. 2.0 might be nice but things will be changing with OpenGL soon anyway, so 1.2 will easily suffice. You can search the forums to maybe find a link to it, but I don't know if it was taken down or not. Maybe Google it. Nobody seems to really know what the legality of it was/is.

Outside of the Red Book, there are lots of sites that have API documentation for OpenGL. There also exist real places called libraries. Well at least they existed when I was a kid. We used to walk/bike to them and borrow books for free! Don't know if they're still around, but it might be worth a look.

What be this invention you call, library? is it some kind of futuristic device used to look up OpenGL??Rasp Sorry.

My library has nothing nada zilch! on programming, much less on OpenGL.

Wait a sec; it does have a 20 page book describing BASIC.Blink

iGame3d: Dixon IL, not Dixon CA. I'm not planning on moving soon.Wink

- Lincoln Green
http://www.binkworks.com/
Quote this message in a reply
Member
Posts: 283
Joined: 2006.05
Post: #15
Danny77uk Wrote:What's wrong with the premade view in IB?

http://developer.apple.com/qa/qa2004/qa1167.html

It's the kind of thing that's fine for ages, and then you realise you need to change it to add certain features, and by then it's annoying to have to go back.
Quote this message in a reply
Post Reply