 |
 |
Getting started with OpenGL.....
|
 |
|
 |
|
Junior Member
Join Date: Dec 2000
Location: Houston, TX, USA
Status:
Offline
|
|
Hello,
So, how can one learn about OpenGL programming and how Cocoa implements it?
Are there any OpenGL books i should look at or read? I've never touched any code having anything to do with OpenGL; that's the level i'm at. Any help is much appreciated. As and aside, how does Quickdraw figure into Cocoa? Are QuickDraw and OpenGL the way to implement graphics into an application? Forgive me if these questions seeme misguided, this is all very new to me. Anyway, thanks!
Mike
|
|
|
| |
|
|
|
 |
|
 |
|
Forum Regular
Join Date: Dec 2000
Status:
Offline
|
|
It's not the best intro, but if you want to look at some GL code,
/Developer/Examples/GLUTExamples
Has a whole mess of OpenGL code. Take a look.
|
|
|
| |
|
|
|
 |
|
 |
|
Admin Emeritus 
Join Date: Nov 2000
Location: New Yawk
Status:
Offline
|
|
Please (*please*) correct me if I'm wrong, but I believe that Mac OS X has abandoned Quickdraw in favor of Quartz, which is superior (vector; PDF) technology.
I don't know how writing for Quickdraw differs from writing for Quartz, but I do think that Quartz is what does Quickdraw's former job now.
does this even matter other than name? not too sure about this, as you can probably tell
------------------
it's only after you lose everything that you're free to do anything
|
|
"Do not be too positive about things. You may be in error." (C. F. Lawlor, The Mixicologist)
|
| |
|
|
|
 |
|
 |
|
Mac Enthusiast
Join Date: Feb 2000
Location: Storrs,Connecticut, USA
Status:
Offline
|
|
Am I missing something? I thought that you didn't need to know any special quartz commands in order to use OpenGL in Cocoa. I've never tried to program anyhting in OpenGL but I thought that It was as simple as dragging an OpenGLView into an NSWindow in Interface Builder, maybe overriding or using some of those methods in NSOpenGLView (All of which say description forthcoming so I have no clue what they do) and then putting some OpenGL code behind that view. I kind of thought that the bulk of the code for making something OpenGl is platform independent. That you'd only have to change a few things in the front end and recompile and viola: it runs on a different platform. Am I wrong?
Anyway, if you want sample code in order to do OpenGl stuff in Cocoa, then why not take a look at some of those screensavers that are popping up everywhere? A lot of them are open source and use Open GL. They might be a better source of info than Apple's description forthcoming documentation.
|
|
|
| |
|
|
|
 |
|
 |
|
Admin Emeritus 
Join Date: Oct 2000
Location: Boston, MA
Status:
Offline
|
|
Yes, using OpenGL is that simple. You just have to drag an NSOpenGLView into the window, and link a few things to it.
You'll just need to name the drawing function specifically and then you can call [self display] i.e.:
#import "MyOpenGLView.h"
#import <OpenGL/gl.h>
#import <OpenGL/glu.h>
@implementation MyOpenGLView
- (void)drawRect  NSRect)aRect
{
glEnable(GL_TEXTURE_2D);
glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
glClearDepth(1.0);
// etc.
}
- (IBAction)clickButton  id)sender
{
[self display]; // This will call the drawRect function ( I hope :-)
}
@end
|
|
"Against stupidity, the gods themselves contend in vain" (Schiller)
|
| |
|
|
|
 |
|
 |
|
Admin Emeritus 
Join Date: Oct 2000
Location: Boston, MA
Status:
Offline
|
|
Whoops, Just replace those frowns with colon left-paren...
Sorry 
|
|
"Against stupidity, the gods themselves contend in vain" (Schiller)
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Jan 2000
Status:
Offline
|
|
|
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|